summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2018-05-01 20:53:07 +0200
committerMatthias Beyer <mail@beyermatthias.de>2018-05-01 21:08:57 +0200
commit2f0a55706877c59473ebe7556ad26ef6666bb6c5 (patch)
treed8efb3595508489c9b77d70c4555c669ab1a9f06 /lib
parent42e2f18fb361c3da3d5bc1530393c0b377ad3a43 (diff)
Fix for passing Arc<_> to store interface instead of Box<_>
Diffstat (limited to 'lib')
-rw-r--r--lib/core/libimagrt/src/runtime.rs3
-rw-r--r--lib/core/libimagstore/src/store.rs8
-rw-r--r--lib/domain/libimagtimetrack/src/iter/mod.rs4
-rw-r--r--lib/entry/libimagentrycategory/src/store.rs3
-rw-r--r--lib/entry/libimagentrydatetime/src/datetime.rs5
-rw-r--r--lib/entry/libimagentrygps/src/entry.rs3
-rw-r--r--lib/entry/libimagentrylink/src/external.rs3
-rw-r--r--lib/entry/libimagentrylink/src/internal.rs3
-rw-r--r--lib/entry/libimagentrymarkdown/src/processor.rs3
9 files changed, 23 insertions, 12 deletions
diff --git a/lib/core/libimagrt/src/runtime.rs b/lib/core/libimagrt/src/runtime.rs
index 8766cda7..093bd3cc 100644
--- a/lib/core/libimagrt/src/runtime.rs
+++ b/lib/core/libimagrt/src/runtime.rs
@@ -22,6 +22,7 @@ use std::process::Command;
use std::env;
use std::process::exit;
use std::io::Stdin;
+use std::sync::Arc;
pub use clap::App;
use clap::AppSettings;
@@ -132,7 +133,7 @@ impl<'a> Runtime<'a> {
let store_result = if cli_app.use_inmemory_fs() {
Store::new_with_backend(storepath,
&config,
- Box::new(InMemoryFileAbstraction::default()))
+ Arc::new(InMemoryFileAbstraction::default()))
} else {
Store::new(storepath, &config)
};
diff --git a/lib/core/libimagstore/src/store.rs b/lib/core/libimagstore/src/store.rs
index ca9f0a1c..f262b38b 100644
--- a/lib/core/libimagstore/src/store.rs
+++ b/lib/core/libimagstore/src/store.rs
@@ -1202,12 +1202,13 @@ Hai
#[cfg(test)]
mod store_tests {
use std::path::PathBuf;
+ use std::sync::Arc;
use super::Store;
use file_abstraction::InMemoryFileAbstraction;
pub fn get_store() -> Store {
- let backend = Box::new(InMemoryFileAbstraction::default());
+ let backend = Arc::new(InMemoryFileAbstraction::default());
Store::new_with_backend(PathBuf::from("/"), &None, backend).unwrap()
}
@@ -1390,10 +1391,11 @@ mod store_tests {
#[test]
fn test_swap_backend_during_runtime() {
use file_abstraction::InMemoryFileAbstraction;
+ use std::sync::Arc;
let mut store = {
let backend = InMemoryFileAbstraction::default();
- let backend = Box::new(backend);
+ let backend = Arc::new(backend);
Store::new_with_backend(PathBuf::from("/"), &None, backend).unwrap()
};
@@ -1409,7 +1411,7 @@ mod store_tests {
{
let other_backend = InMemoryFileAbstraction::default();
- let other_backend = Box::new(other_backend);
+ let other_backend = Arc::new(other_backend);
assert!(store.reset_backend(other_backend).is_ok())
}
diff --git a/lib/domain/libimagtimetrack/src/iter/mod.rs b/lib/domain/libimagtimetrack/src/iter/mod.rs
index f0648ce2..556d8b93 100644
--- a/lib/domain/libimagtimetrack/src/iter/mod.rs
+++ b/lib/domain/libimagtimetrack/src/iter/mod.rs
@@ -26,6 +26,8 @@ pub mod tag;
#[cfg(test)]
mod test {
+ use std::sync::Arc;
+
use chrono::naive::NaiveDate;
use libimagstore::store::Store;
@@ -37,7 +39,7 @@ mod test {
use std::path::PathBuf;
use libimagstore::file_abstraction::InMemoryFileAbstraction;
- let backend = Box::new(InMemoryFileAbstraction::default());
+ let backend = Arc::new(InMemoryFileAbstraction::default());
Store::new_with_backend(PathBuf::from("/"), &None, backend).unwrap()
}
diff --git a/lib/entry/libimagentrycategory/src/store.rs b/lib/entry/libimagentrycategory/src/store.rs
index e1fb929a..8179010d 100644
--- a/lib/entry/libimagentrycategory/src/store.rs
+++ b/lib/entry/libimagentrycategory/src/store.rs
@@ -111,6 +111,7 @@ impl CategoryStore for Store {
mod tests {
extern crate env_logger;
use std::path::PathBuf;
+ use std::sync::Arc;
use super::*;
@@ -118,7 +119,7 @@ mod tests {
pub fn get_store() -> Store {
use libimagstore::store::InMemoryFileAbstraction;
- let backend = Box::new(InMemoryFileAbstraction::default());
+ let backend = Arc::new(InMemoryFileAbstraction::default());
Store::new_with_backend(PathBuf::from("/"), &None, backend).unwrap()
}
diff --git a/lib/entry/libimagentrydatetime/src/datetime.rs b/lib/entry/libimagentrydatetime/src/datetime.rs
index 6eb6683d..790f9f84 100644
--- a/lib/entry/libimagentrydatetime/src/datetime.rs
+++ b/lib/entry/libimagentrydatetime/src/datetime.rs
@@ -195,7 +195,7 @@ fn val_to_ndt(v: &Value) -> Result<NaiveDateTime> {
#[cfg(test)]
mod tests {
use std::path::PathBuf;
- use toml_query::read::TomlValueReadExt;
+ use std::sync::Arc;
use super::*;
@@ -204,10 +204,11 @@ mod tests {
use chrono::naive::NaiveDateTime;
use chrono::naive::NaiveDate;
use chrono::naive::NaiveTime;
+ use toml_query::read::TomlValueReadExt;
pub fn get_store() -> Store {
use libimagstore::store::InMemoryFileAbstraction;
- let backend = Box::new(InMemoryFileAbstraction::default());
+ let backend = Arc::new(InMemoryFileAbstraction::default());
Store::new_with_backend(PathBuf::from("/"), &None, backend).unwrap()
}
diff --git a/lib/entry/libimagentrygps/src/entry.rs b/lib/entry/libimagentrygps/src/entry.rs
index 37acb075..d6eb4be7 100644
--- a/lib/entry/libimagentrygps/src/entry.rs
+++ b/lib/entry/libimagentrygps/src/entry.rs
@@ -102,6 +102,7 @@ impl GPSEntry for Entry {
#[cfg(test)]
mod tests {
use std::path::PathBuf;
+ use std::sync::Arc;
use libimagstore::store::Store;
@@ -113,7 +114,7 @@ mod tests {
fn get_store() -> Store {
use libimagstore::file_abstraction::InMemoryFileAbstraction;
- let backend = Box::new(InMemoryFileAbstraction::default());
+ let backend = Arc::new(InMemoryFileAbstraction::default());
Store::new_with_backend(PathBuf::from("/"), &None, backend).unwrap()
}
diff --git a/lib/entry/libimagentrylink/src/external.rs b/lib/entry/libimagentrylink/src/external.rs
index 4d7d48bc..2d5592c6 100644
--- a/lib/entry/libimagentrylink/src/external.rs
+++ b/lib/entry/libimagentrylink/src/external.rs
@@ -406,6 +406,7 @@ impl ExternalLinker for Entry {
mod tests {
use super::*;
use std::path::PathBuf;
+ use std::sync::Arc;
use libimagstore::store::Store;
@@ -416,7 +417,7 @@ mod tests {
pub fn get_store() -> Store {
use libimagstore::file_abstraction::InMemoryFileAbstraction;
- let backend = Box::new(InMemoryFileAbstraction::default());
+ let backend = Arc::new(InMemoryFileAbstraction::default());
Store::new_with_backend(PathBuf::from("/"), &None, backend).unwrap()
}
diff --git a/lib/entry/libimagentrylink/src/internal.rs b/lib/entry/libimagentrylink/src/internal.rs
index e7c06fd7..480a07bc 100644
--- a/lib/entry/libimagentrylink/src/internal.rs
+++ b/lib/entry/libimagentrylink/src/internal.rs
@@ -772,6 +772,7 @@ pub mod store_check {
#[cfg(test)]
mod test {
use std::path::PathBuf;
+ use std::sync::Arc;
use libimagstore::store::Store;
@@ -784,7 +785,7 @@ mod test {
pub fn get_store() -> Store {
use libimagstore::file_abstraction::InMemoryFileAbstraction;
- let backend = Box::new(InMemoryFileAbstraction::default());
+ let backend = Arc::new(InMemoryFileAbstraction::default());
Store::new_with_backend(PathBuf::from("/"), &None, backend).unwrap()
}
diff --git a/lib/entry/libimagentrymarkdown/src/processor.rs b/lib/entry/libimagentrymarkdown/src/processor.rs
index f9b085a5..5fddcd9e 100644
--- a/lib/entry/libimagentrymarkdown/src/processor.rs
+++ b/lib/entry/libimagentrymarkdown/src/processor.rs
@@ -233,6 +233,7 @@ mod tests {
use super::*;
use std::path::PathBuf;
+ use std::sync::Arc;
use libimagstore::store::Store;
use libimagentrylink::internal::InternalLinker;
@@ -244,7 +245,7 @@ mod tests {
pub fn get_store() -> Store {
use libimagstore::file_abstraction::InMemoryFileAbstraction;
let fs = InMemoryFileAbstraction::default();
- Store::new_with_backend(PathBuf::from("/"), &None, Box::new(fs)).unwrap()
+ Store::new_with_backend(PathBuf::from("/"), &None, Arc::new(fs)).unwrap()
}
#[test]