Go back to std mutex, which will be significantly faster in rust 1.62

This commit is contained in:
Aode (Lion) 2022-04-15 12:44:05 -05:00
parent 2bc109524f
commit ee74a4af3c
2 changed files with 12 additions and 5 deletions

View file

@ -1,7 +1,7 @@
[package]
name = "storage-path-generator"
description = "A tool to generate efficient directory structures"
version = "0.1.0"
version = "0.1.1"
authors = ["asonix <asonix@asonix.dog>"]
license = "AGPL-3.0"
repository = "https://git.asonix.dog/asonix/storage-path-generator"
@ -10,4 +10,3 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
parking_lot = "0.11"

View file

@ -1,5 +1,7 @@
use parking_lot::Mutex;
use std::{convert::TryInto, sync::Arc};
use std::{
convert::TryInto,
sync::{Arc, Mutex},
};
#[derive(Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
struct Inner {
@ -59,7 +61,7 @@ impl Generator {
}
pub fn next(&self) -> Path {
let inner = self.current.lock().next();
let inner = self.current.lock().unwrap().next();
Path { inner }
}
@ -140,3 +142,9 @@ impl std::fmt::Display for PathError {
}
impl std::error::Error for PathError {}
impl Default for Generator {
fn default() -> Self {
Self::new()
}
}