diff options
| author | C. Morgan Hamill <me@cmhamill.org> | 2015-03-24 19:55:02 +0100 |
|---|---|---|
| committer | C. Morgan Hamill <me@cmhamill.org> | 2015-03-24 19:55:02 +0100 |
| commit | 0c55e4e4d5bb8b9098fc6f780a74e99f436153c0 (patch) | |
| tree | be17897961f2836cd356d59049e5504172d2dcca /src/database.rs | |
| parent | 4a314517ad9d52884232e4ed7e3b0d01e6e9b1e3 (diff) | |
| download | mail-0c55e4e4d5bb8b9098fc6f780a74e99f436153c0.tar.gz | |
Make methods borrow self mutably when appropriate.
Use of raw pointers and FFI functions mean that the compiler won't force
us to be correct in our usage of `&self` vs. `&mut self`.
These functions make changes to the notmuch database, and we want the
type system to ensure we can't simultaneously manipulate the database
from different functions.
Diffstat (limited to 'src/database.rs')
| -rw-r--r-- | src/database.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/database.rs b/src/database.rs index 46ca45d..7469bb0 100644 --- a/src/database.rs +++ b/src/database.rs @@ -118,16 +118,16 @@ impl Database { } } - pub fn upgrade<F: FnMut(f64)>(&self) -> Result<()> { + pub fn upgrade<F: FnMut(f64)>(&mut self) -> Result<()> { let status: Option<F> = None; self._upgrade(status) } - pub fn upgrade_with_status<F: FnMut(f64)>(&self, status: F) -> Result<()> { + pub fn upgrade_with_status<F: FnMut(f64)>(&mut self, status: F) -> Result<()> { self._upgrade(Some(status)) } - fn _upgrade<F: FnMut(f64)>(&self, status: Option<F>) -> Result<()> { + fn _upgrade<F: FnMut(f64)>(&mut self, status: Option<F>) -> Result<()> { extern fn wrapper<F: FnMut(f64)>( closure: *mut libc::c_void, progress: libc::c_double, |
