Go back to std mutex, which will be significantly faster in rust 1.62
This commit is contained in:
parent
2bc109524f
commit
ee74a4af3c
|
@ -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"
|
||||
|
|
14
src/lib.rs
14
src/lib.rs
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue