Skip to main content

BaseTreapEntry

Struct BaseTreapEntry 

Source
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: V

Implementations§

Source§

impl<SortingKey: Ord, FilteringKey: Ord + Clone, V> BaseTreapEntry<SortingKey, FilteringKey, V>

Source

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>

Source§

type SortingKey = SortingKey

Key type for BST ordering. Can be a tuple for compound keys.
Source§

type FilteringKey = FilteringKey

Key type for filtering/pruning.
Source§

type Value = V

Value type stored in the entry.
Source§

fn sorting_key(&self) -> &Self::SortingKey

Returns the sorting key for BST ordering.
Source§

fn filtering_key(&self) -> &Self::FilteringKey

Returns the filtering key for pruning decisions.
Source§

fn value(&self) -> &Self::Value

Returns a shared reference to the underlying value.
Source§

fn value_mut(&mut self) -> &mut Self::Value

Returns an exclusive reference to the underlying value.

Auto Trait Implementations§

§

impl<SortingKey, FilteringKey, V> Freeze for BaseTreapEntry<SortingKey, FilteringKey, V>
where SortingKey: Freeze, FilteringKey: Freeze, V: Freeze,

§

impl<SortingKey, FilteringKey, V> RefUnwindSafe for BaseTreapEntry<SortingKey, FilteringKey, V>
where SortingKey: RefUnwindSafe, FilteringKey: RefUnwindSafe, V: RefUnwindSafe,

§

impl<SortingKey, FilteringKey, V> Send for BaseTreapEntry<SortingKey, FilteringKey, V>
where SortingKey: Send, FilteringKey: Send, V: Send,

§

impl<SortingKey, FilteringKey, V> Sync for BaseTreapEntry<SortingKey, FilteringKey, V>
where SortingKey: Sync, FilteringKey: Sync, V: Sync,

§

impl<SortingKey, FilteringKey, V> Unpin for BaseTreapEntry<SortingKey, FilteringKey, V>
where SortingKey: Unpin, FilteringKey: Unpin, V: Unpin,

§

impl<SortingKey, FilteringKey, V> UnsafeUnpin for BaseTreapEntry<SortingKey, FilteringKey, V>
where SortingKey: UnsafeUnpin, FilteringKey: UnsafeUnpin, V: UnsafeUnpin,

§

impl<SortingKey, FilteringKey, V> UnwindSafe for BaseTreapEntry<SortingKey, FilteringKey, V>
where SortingKey: UnwindSafe, FilteringKey: UnwindSafe, V: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.