pub struct BaseTreapEntry<SortingKey: Ord, FilteringKey: Ord + Clone, V> {
pub sorting_key: SortingKey,
pub filtering_key: FilteringKey,
pub value: V,
}Expand description
A ready-to-use TreapEntry implementation wrapping a sorting key,
filtering key, and a value.
Use this when you don’t need a custom entry type.
§Example
use orengine_utils::treap::{BaseTreapEntry, Treap};
let mut treap = Treap::<BaseTreapEntry<u32, u32, &str>>::new();
treap.set(BaseTreapEntry::new(1, 10, "hello"));
assert_eq!(treap.find(&1).unwrap().value, "hello");Fields§
§sorting_key: SortingKey§filtering_key: FilteringKey§value: VImplementations§
Source§impl<SortingKey: Ord, FilteringKey: Ord + Clone, V> BaseTreapEntry<SortingKey, FilteringKey, V>
impl<SortingKey: Ord, FilteringKey: Ord + Clone, V> BaseTreapEntry<SortingKey, FilteringKey, V>
Sourcepub fn new(
sorting_key: SortingKey,
filtering_key: FilteringKey,
value: V,
) -> Self
pub fn new( sorting_key: SortingKey, filtering_key: FilteringKey, value: V, ) -> Self
Creates a new BaseTreapEntry with the given sorting key, filtering key, and value.
§Example
use orengine_utils::treap::BaseTreapEntry;
let entry = BaseTreapEntry::new(42u32, 7u32, "payload");
assert_eq!(entry.sorting_key, 42);
assert_eq!(entry.filtering_key, 7);
assert_eq!(entry.value, "payload");Trait Implementations§
Source§impl<SortingKey: Ord, FilteringKey: Ord + Clone, V> TreapEntry for BaseTreapEntry<SortingKey, FilteringKey, V>
impl<SortingKey: Ord, FilteringKey: Ord + Clone, V> TreapEntry for BaseTreapEntry<SortingKey, FilteringKey, V>
Source§type SortingKey = SortingKey
type SortingKey = SortingKey
Key type for BST ordering. Can be a tuple for compound keys.
Source§type FilteringKey = FilteringKey
type FilteringKey = FilteringKey
Key type for filtering/pruning.
Source§fn sorting_key(&self) -> &Self::SortingKey
fn sorting_key(&self) -> &Self::SortingKey
Returns the sorting key for BST ordering.
Source§fn filtering_key(&self) -> &Self::FilteringKey
fn filtering_key(&self) -> &Self::FilteringKey
Returns the filtering key for pruning decisions.
Auto Trait Implementations§
impl<SortingKey, FilteringKey, V> Freeze for BaseTreapEntry<SortingKey, FilteringKey, V>
impl<SortingKey, FilteringKey, V> RefUnwindSafe for BaseTreapEntry<SortingKey, FilteringKey, V>
impl<SortingKey, FilteringKey, V> Send for BaseTreapEntry<SortingKey, FilteringKey, V>
impl<SortingKey, FilteringKey, V> Sync for BaseTreapEntry<SortingKey, FilteringKey, V>
impl<SortingKey, FilteringKey, V> Unpin for BaseTreapEntry<SortingKey, FilteringKey, V>
impl<SortingKey, FilteringKey, V> UnsafeUnpin for BaseTreapEntry<SortingKey, FilteringKey, V>
impl<SortingKey, FilteringKey, V> UnwindSafe for BaseTreapEntry<SortingKey, FilteringKey, V>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more