try get first

This commit is contained in:
Tony
2024-10-03 13:56:43 +08:00
parent 3acf66ee57
commit 42c5a1cb56
5 changed files with 7 additions and 5 deletions
+2 -2
View File
@@ -177,8 +177,8 @@ pub trait StoreExt<R: Runtime> {
impl<R: Runtime, T: Manager<R>> StoreExt<R> for T {
fn store(&self, path: impl AsRef<Path>) -> Arc<Store<R>> {
self.create_store(&path)
.unwrap_or_else(|_| self.get_store(path).unwrap())
self.get_store(&path)
.unwrap_or_else(|| self.create_store(&path).unwrap())
}
fn create_store(&self, path: impl AsRef<Path>) -> Result<Arc<Store<R>>> {