[−][src]Function serenity::utils::with_cache_mut
pub fn with_cache_mut<T, F>(cache: impl AsRef<CacheRwLock>, f: F) -> T where
F: FnMut(&mut Cache) -> T,
Like with_cache
but as the name says, allows for modifications to be done.
Examples
Return the bot's id, and changes the shard count
ⓘThis example is not tested
use serenity::utils; // assuming that the id is `1234`: assert_eq!(1234, utils::with_cache_mut(|cache| { cache.shard_count = 8;cache.as_ref().user.id }));