Struct canadensis_core::session::SessionDynamicMap
source · pub struct SessionDynamicMap<I, N, T, D>where
I: Instant,{ /* private fields */ }
Expand description
A session map that uses dynamic memory allocation
Caution: This implementation cannot detect when memory allocation fails, so it may cause the program to abort. Only use it when memory is plentiful.
This implementation uses variable amounts of memory and takes O(log(number of sessions))
time.
Trait Implementations§
source§impl<I, N, T, D> SessionTracker<I, N, T, D> for SessionDynamicMap<I, N, T, D>where
I: Instant,
N: Ord + Clone + Debug,
impl<I, N, T, D> SessionTracker<I, N, T, D> for SessionDynamicMap<I, N, T, D>where I: Instant, N: Ord + Clone + Debug,
source§fn get(&self, node: N) -> Option<&Session<I, T, D>>
fn get(&self, node: N) -> Option<&Session<I, T, D>>
Returns a reference to the session for the provided node, if one exists
source§fn get_mut(&mut self, node: N) -> Option<&mut Session<I, T, D>>
fn get_mut(&mut self, node: N) -> Option<&mut Session<I, T, D>>
Returns a mutable reference to the session for the provided node, if one exists
source§fn get_mut_or_insert_with<F>(
&mut self,
node: N,
generator: F
) -> Result<&mut Session<I, T, D>, OutOfMemoryError>where
N: Clone,
F: FnOnce() -> Session<I, T, D>,
fn get_mut_or_insert_with<F>( &mut self, node: N, generator: F ) -> Result<&mut Session<I, T, D>, OutOfMemoryError>where N: Clone, F: FnOnce() -> Session<I, T, D>,
Returns a mutable reference to the session for the provided node Read more
source§fn insert(
&mut self,
node: N,
session: Session<I, T, D>
) -> Result<(), OutOfMemoryError>
fn insert( &mut self, node: N, session: Session<I, T, D> ) -> Result<(), OutOfMemoryError>
Inserts a session Read more
source§fn remove_expired(&mut self, now: I)
fn remove_expired(&mut self, now: I)
Removes all sessions that have expired