diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2016-07-06 20:05:37 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2016-07-21 17:14:11 +0200 |
commit | 07ab966d3797ad4d98898f087024d5039b5f6bf7 (patch) | |
tree | 90f98b047baa2c18c5f3b1ba1061a1037548e14f /libimagtodo | |
parent | f3dc1e90af12a9477f80f7f9c575c9f591bdf040 (diff) |
Impl {Deref, DerefMut} for Task
Diffstat (limited to 'libimagtodo')
-rw-r--r-- | libimagtodo/src/task.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libimagtodo/src/task.rs b/libimagtodo/src/task.rs index 87429683..0c68e4c0 100644 --- a/libimagtodo/src/task.rs +++ b/libimagtodo/src/task.rs @@ -1,4 +1,6 @@ use std::collections::BTreeMap; +use std::ops::{Deref, DerefMut}; + use toml::Value; use task_hookrs::task::Task as TTask; @@ -23,6 +25,23 @@ impl<'a> Task<'a> { } +impl<'a> Deref for Task<'a> { + type Target = FileLockEntry<'a>; + + fn deref(&self) -> &FileLockEntry<'a> { + &self.0 + } + +} + +impl<'a> DerefMut for Task<'a> { + + fn deref_mut(&mut self) -> &mut FileLockEntry<'a> { + &mut self.0 + } + +} + /// A trait to get a `libimagtodo::task::Task` out of the implementing object. /// This Task struct is merely a wrapper for a `FileLockEntry`, therefore the function name /// `into_filelockentry`. |