summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2017-02-26 19:55:35 +0100
committerMatthias Beyer <mail@beyermatthias.de>2017-03-08 12:47:40 +0100
commit1c43abb0b0d55650dded4f8bab995c295b3bf997 (patch)
tree96e8fb3ca9c62ce6f1109b6a2ba8cd12cce6d5b4
parenta53547e08a1b13636a907e6618fe128974776aec (diff)
downloadimag-1c43abb0b0d55650dded4f8bab995c295b3bf997.zip
imag-1c43abb0b0d55650dded4f8bab995c295b3bf997.tar.gz
Fix for new Store::update() interface
-rw-r--r--libimagruby/src/store.rs3
-rw-r--r--libimagstore/src/store.rs13
2 files changed, 9 insertions, 7 deletions
diff --git a/libimagruby/src/store.rs b/libimagruby/src/store.rs
index f20481b..4530969 100644
--- a/libimagruby/src/store.rs
+++ b/libimagruby/src/store.rs
@@ -426,7 +426,8 @@ methods!(
store <- itself wrapped inside STORE_WRAPPER,
real_fle <- fetch fle,
operation {
- if let Err(e) = store.update(real_fle) {
+ let mut real_fle = real_fle; // rebind for mut
+ if let Err(e) = store.update(&mut real_fle) {
trace_error(&e);
VM::raise(Class::from_existing("RuntimeError"), e.description());
}
diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs
index 12b8b0f..accf96c 100644
--- a/libimagstore/src/store.rs
+++ b/libimagstore/src/store.rs
@@ -606,7 +606,7 @@ impl Store {
///
/// See `Store::_update()`.
///
- pub fn update<'a>(&'a self, mut entry: &FileLockEntry<'a>) -> Result<()> {
+ pub fn update<'a>(&'a self, entry: &mut FileLockEntry<'a>) -> Result<()> {
self._update(entry, false).map_err_into(SEK::UpdateCallError)
}
@@ -2007,7 +2007,8 @@ aspect = "test"
{
println!("Getting {:?} -> Some -> updating", pb_moved);
assert!(match store.get(pb_moved.clone()).map_err(|e| println!("ERROR GETTING: {:?}", e)) {
- Ok(Some(fle)) => store.update(fle).map_err(|e| println!("ERROR UPDATING: {:?}", e)).is_ok(),
+ Ok(Some(fle)) => store.update(&mut fle)
+ .map_err(|e| println!("ERROR UPDATING: {:?}", e)).is_ok(),
_ => false,
});
}
@@ -2112,7 +2113,7 @@ aspect = "test"
let store = get_store_with_aborting_hook_at_pos(HP::PreUpdate);
let fle = store.create(storeid).unwrap();
- assert!(store.update(fle).is_err());
+ assert!(store.update(&mut fle).is_err());
}
#[test]
@@ -2159,7 +2160,7 @@ aspect = "test"
let pb = pb.with_base(store.path().clone());
assert!(store.entries.read().unwrap().get(&pb).is_some());
- assert!(store.update(fle).is_err());
+ assert!(store.update(&mut fle).is_err());
}
fn get_store_with_allowed_error_hook_at_pos(pos: HP) -> Store {
@@ -2198,7 +2199,7 @@ aspect = "test"
let store = get_store_with_allowed_error_hook_at_pos(HP::PreUpdate);
let fle = store.create(storeid).unwrap();
- assert!(store.update(fle).is_ok());
+ assert!(store.update(&mut fle).is_ok());
}
#[test]
@@ -2245,7 +2246,7 @@ aspect = "test"
let pb = pb.with_base(store.path().clone());
assert!(store.entries.read().unwrap().get(&pb).is_some());
- assert!(store.update(fle).is_ok());
+ assert!(store.update(&mut fle).is_ok());
}
}