Struct lockfree::set::Set

source ·
pub struct Set<T, H = RandomState> { /* private fields */ }
Expand description

A lock-free set. This is currently implemented on top of Map. To check more details about it, please see Map docs.

Implementations

Creates a Set with the default hasher builder.

Creates the Set using the given shared incinerator.

Creates an iterator over guarded references to the elements.

Creates a Set with the given hasher builder.

Creates the Set using the given hasher builder and shared incinerator.

The shared incinerator used by this Map.

Returns the hasher builder used by this Set.

Tries to optimize space by removing unnecessary tables without removing any element. This method cannot be performed in a shared context.

Removes all elements. This method cannot be performed in a shared context.

Tests if the given element is present on the Set. The method accepts a type resulted from borrowing the stored element. This method will only work correctly if Hash and Ord are implemented in the same way for the borrowed type and the stored type.

Returns a guarded reference to the given element in the Set. This may be useful for types with additional metadata. The method accepts a type resulted from borrowing the stored element. This method will only work correctly if Hash and Ord are implemented in the same way for the borrowed type and the stored type. If the element is not found, None is obviously returned.

Inserts the element into the Set. If the element was already present, Err(the_passed_value) is returned.

Inserts interactively the element into the Set. A passed closure tests if the insertion should proceed. The first argument of the closure is the element passed to insert_with and the second is the stored found element, if any. The closure returns whether the insertion should go on. This method is useful for types with metadata.

Tries to reinsert a previously removed element. The element must have been either:

  1. Removed from this very Set.
  2. Removed from an already dead Set.
  3. Removed from a Set which has no sensitive reads active.

If the removed element does not fit any category, the insertion will fail. Otherwise, insertion cannot fail.

Tries to reinsert interactively a previously removed element. A closure is passed to test if the reinsertion should proceed The first argument to the closure is a reference to the given element and the second is a reference to the found stored element, if any. The closure returns whether the reinsertion should go on. The removed element must have been either:

  1. Removed from this very Set.
  2. Removed from an already dead Set.
  3. Removed from a Set which has no sensitive reads active.

If the removed element does not fit any category, the insertion will fail. Otherwise, insertion cannot fail.

Removes the given element inconditionally. The method accepts a type resulted from borrowing the stored element. This method will only work correctly if Hash and Ord are implemented in the same way for the borrowed type and the stored type.

Removes interactively the given element. A closure is passed to validate the removal. The only argument passed to the closure is a reference to the found stored element. The return value is whether the removal should happen or not. The method accepts a type resulted from borrowing the stored element. This method will only work correctly if Hash and Ord are implemented in the same way for the borrowed type and the stored type.

Acts just like Extend::extend but does not require mutability.

Trait Implementations

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Extends a collection with the contents of an iterator. Read more
🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Creates a value from an iterator. Read more
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.