From 22c2e4e2db9ad9d892ed5fb63d92254677f6dafd Mon Sep 17 00:00:00 2001 From: alyx Date: Mon, 1 Apr 2024 19:00:57 -0400 Subject: Reliable user info; Font refactor Hit a few more endpoints to fix missing images, fallback to default album art just in case. Refactor the font cache into its own file. --- src/cache.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/cache.rs') diff --git a/src/cache.rs b/src/cache.rs index 0e8fd4d..a6f25fa 100644 --- a/src/cache.rs +++ b/src/cache.rs @@ -1,5 +1,14 @@ -use std::{future::Future, time::*, collections::HashMap, hash::Hash}; +use std::future::Future; +use std::time::*; +use std::collections::HashMap; +use std::hash::Hash; +use std::sync::Arc; +use std::pin::Pin; + +use tokio::sync::RwLock; + use reqwest::StatusCode; + #[derive(Debug)] pub struct AsyncCache { func: F, @@ -66,3 +75,7 @@ where self.get(key).await.cloned() } } + +pub type CacheFuture = Pin> + Send + Sync)>>; +pub type CacheGetter = fn(&String) -> CacheFuture; +pub type Cache = Arc>>>; -- cgit v1.2.3-54-g00ecf