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]

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]

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]

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]

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]

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]

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 that self is derived from.
  • hash, key and value must match the value used when self was derived.
  • There must not have been any insertions or replace calls to the table since self was derived.

Trait Implementations

impl<'a> Clone for PotentialSlot<'a>[src]

impl<'a> Copy for PotentialSlot<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for PotentialSlot<'a>

impl<'a> Send for PotentialSlot<'a>

impl<'a> Sync for PotentialSlot<'a>

impl<'a> Unpin for PotentialSlot<'a>

impl<'a> UnwindSafe for PotentialSlot<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.