Expand description
§data structures
cordyceps
provides implementations of the following data structures:
-
List
: a mutable, doubly-linked list.A
List
provides O(1) insertion and removal at both the head and tail of the list. In addition, parts of aList
may be split off to form newList
s, and twoList
s may be spliced together to form a singleList
, all in O(1) time. Thelist
module also provideslist::Cursor
andlist::CursorMut
types, which allow traversal and modification of elements in a list. Finally, elements can remove themselves from arbitrary positions in aList
, provided that they have mutable access to theList
itself. This makes theList
type suitable for use in cases where elements must be able to drop themselves while linked into a list.The
List
type is not a lock-free data structure, and can only be modified through&mut
references. -
MpscQueue
: a multi-producer, single-consumer (MPSC) lock-free last-in, first-out (LIFO) queue.A
MpscQueue
is a lock-free concurrent data structure that allows multiple producers to concurrently push elements onto the queue, and a single consumer to dequeue elements in the order that they were pushed.MpscQueue
s can be used to efficiently share data from multiple concurrent producers with a consumer. -
Stack
: a mutable, singly-linked first-in, first-out (FIFO) stack.This is a simple, singly-linked stack with O(1) push and pop operations. The pop operation returns the last element pushed to the stack. A
Stack
also implements theIterator
trait; iterating over a stack pops elements from the end of the list.The
Stack
type is not a lock-free data structure, and can only be modified through&mut
references. -
TransferStack
: a lock-free, multi-producer FIFO stack, where all elements currently in the stack are popped in a single atomic operation.A
TransferStack
is a lock-free data structure where multiple producers can concurrently push elements to the end of the stack through immutable&
references. A consumer can pop all elements currently in theTransferStack
in a single atomic operation, returning a newStack
. Pushing an element, and taking all elements in theTransferStack
are both O(1) operations.A
TransferStack
can be used to efficiently transfer ownership of resources from multiple producers to a consumer, such as for reuse or cleanup.
Modules§
- An intrusive doubly-linked list.
- A multi-producer, single-consumer (MPSC) queue, implemented using a lock-free intrusive singly-linked list.
- Intrusive, singly-linked first-in, first-out (FIFO) stacks.
Structs§
- An intrusive doubly-linked list.
- A multi-producer, single-consumer (MPSC) queue, implemented using a lock-free intrusive singly-linked list.
- An intrusive singly-linked mutable FIFO stack.
- An intrusive lock-free singly-linked FIFO stack, where all entries currently in the stack are consumed in a single atomic operation.
Traits§
- Trait implemented by types which can be members of an intrusive collection.