Use question mark in get
This commit is contained in:
parent
2650a96d16
commit
525aef91bf
2 changed files with 7 additions and 10 deletions
|
@ -32,7 +32,7 @@ simple_logger = "1"
|
|||
sodiumoxide = "0.2"
|
||||
ssri = "5"
|
||||
thiserror = "1"
|
||||
tokio = { version = "1", features = [ "full" ] }
|
||||
tokio = { version = "1", features = [ "full", "parking_lot" ] }
|
||||
url = { version = "2", features = [ "serde" ] }
|
||||
|
||||
[profile.release]
|
||||
|
|
5
src/cache/low_mem.rs
vendored
5
src/cache/low_mem.rs
vendored
|
@ -33,15 +33,12 @@ impl Cache for LowMemCache {
|
|||
&mut self,
|
||||
key: &CacheKey,
|
||||
) -> Option<Result<(CacheStream, &ImageMetadata), CacheError>> {
|
||||
if let Some(metadata) = self.on_disk.get(key) {
|
||||
let metadata = self.on_disk.get(key)?;
|
||||
let path = self.disk_path.clone().join(PathBuf::from(key.clone()));
|
||||
super::fs::read_file(&path).await.map(|res| {
|
||||
res.map(|stream| (CacheStream::Fs(stream), metadata))
|
||||
.map_err(Into::into)
|
||||
})
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
async fn put(
|
||||
|
|
Loading…
Reference in a new issue