Expand description
§data structures
cordyceps provides implementations of the following data structures:
-
List: a mutable, doubly-linked list.A
Listprovides O(1) insertion and removal at both the head and tail of the list. In addition, parts of aListmay be split off to form newLists, and twoLists may be spliced together to form a singleList, all in O(1) time. Thelistmodule also provideslist::Cursorandlist::CursorMuttypes, 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 theListitself. This makes theListtype suitable for use in cases where elements must be able to drop themselves while linked into a list.The
Listtype is not a lock-free data structure, and can only be modified through&mutreferences. -
MpscQueue: a multi-producer, single-consumer (MPSC) lock-free last-in, first-out (LIFO) queue.A
MpscQueueis 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.MpscQueues 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
Stackalso implements theIteratortrait; iterating over a stack pops elements from the end of the list.The
Stacktype is not a lock-free data structure, and can only be modified through&mutreferences. -
TransferStack: a lock-free, multi-producer FIFO stack, where all elements currently in the stack are popped in a single atomic operation.A
TransferStackis 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 theTransferStackin a single atomic operation, returning a newStack. Pushing an element, and taking all elements in theTransferStackare both O(1) operations.A
TransferStackcan be used to efficiently transfer ownership of resources from multiple producers to a consumer, such as for reuse or cleanup.
Modules§
- list
- An intrusive doubly-linked list.
- mpsc_
queue - A multi-producer, single-consumer (MPSC) queue, implemented using a lock-free intrusive singly-linked list.
- stack
- Intrusive, singly-linked first-in, first-out (FIFO) stacks.
Structs§
- List
- An intrusive doubly-linked list.
- Mpsc
Queue - A multi-producer, single-consumer (MPSC) queue, implemented using a lock-free intrusive singly-linked list.
- Stack
- An intrusive singly-linked mutable FIFO stack.
- Transfer
Stack - An intrusive lock-free singly-linked FIFO stack, where all entries currently in the stack are consumed in a single atomic operation.
Traits§
- Linked
- Trait implemented by types which can be members of an intrusive collection.