pub struct LCMCache { /* private fields */ }
Expand description
A simple passthrough cache that preferentially returns cached LCM data for a room, dynamically generating LCM data as-needed from a user-provided closure and caching it before returning it.
Implementations§
Source§impl LCMCache
impl LCMCache
Sourcepub fn get_cached_lcm(&self, room_name: &RoomName) -> Option<&LocalCostMatrix>
pub fn get_cached_lcm(&self, room_name: &RoomName) -> Option<&LocalCostMatrix>
Returns the cached LCM, if it exists.
Returns None if the LCM isn’t cached.
Sourcepub fn is_lcm_cached(&self, room_name: &RoomName) -> bool
pub fn is_lcm_cached(&self, room_name: &RoomName) -> bool
Returns whether an LCM is cached for a particular room.
Sourcepub fn get_lcm(
&mut self,
room_name: &RoomName,
generator_fn: impl FnOnce(&RoomName) -> LocalCostMatrix,
) -> &LocalCostMatrix
pub fn get_lcm( &mut self, room_name: &RoomName, generator_fn: impl FnOnce(&RoomName) -> LocalCostMatrix, ) -> &LocalCostMatrix
Returns the room LCM, generating and caching it if it’s not already cached.
Sourcepub fn update_cached_lcm(&mut self, room_name: RoomName, lcm: LocalCostMatrix)
pub fn update_cached_lcm(&mut self, room_name: RoomName, lcm: LocalCostMatrix)
Updates the LCM cache for a specific room.
This allows for pre-loading the cache with any existing room LCM data you might already have available.
Sourcepub fn remove_cached_lcm(&mut self, room_name: &RoomName)
pub fn remove_cached_lcm(&mut self, room_name: &RoomName)
Removes the LCM cached for a specific room.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LCMCache
impl RefUnwindSafe for LCMCache
impl Send for LCMCache
impl Sync for LCMCache
impl Unpin for LCMCache
impl UnwindSafe for LCMCache
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