Expand description
A fixed sorted priority linked list, similar to BinaryHeap
but with different properties
on push
, pop
, etc.
For example, the sorting of the list will never memcpy
the underlying value, so having large
objects in the list will not cause a performance hit.
§Examples
use heapless::sorted_linked_list::{Max, SortedLinkedList};
let mut ll: SortedLinkedList<_, Max, 3, u8> = SortedLinkedList::new_u8();
// The largest value will always be first
ll.push(1).unwrap();
assert_eq!(ll.peek(), Some(&1));
ll.push(2).unwrap();
assert_eq!(ll.peek(), Some(&2));
ll.push(3).unwrap();
assert_eq!(ll.peek(), Some(&3));
// This will not fit in the queue.
assert_eq!(ll.push(4), Err(4));
Structs§
- Find
MutView - Comes from
SortedLinkedList::find_mut
. - Iter
View - Iterator for the linked list.
- Max
- Marker for Max sorted
SortedLinkedList
. - Min
- Marker for Min sorted
SortedLinkedList
. - Node
- A node in the
SortedLinkedList
. - Sorted
Linked List Inner - Base struct for
SortedLinkedList
andSortedLinkedListView
, generic over theSortedLinkedListStorage
.
Traits§
- Kind
- The linked list kind: min-list or max-list
- Sorted
Linked List Storage - Trait defining how data for a container is stored.
Type Aliases§
- Owned
Sorted Linked List Storage - Implementation of
SortedLinkedListStorage
that stores the data in an array[T; N]
whose size is known at compile time. - Sorted
Linked List - The linked list.
- Sorted
Linked List View - The linked list.
- View
Sorted Linked List Storage - Implementation of
SortedLinkedListStorage
that stores the data in an unsized[T]
.