Impl {Deref, DerefMut} for Task
This commit is contained in:
parent
f3dc1e90af
commit
07ab966d37
1 changed files with 19 additions and 0 deletions
|
@ -1,4 +1,6 @@
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
use std::ops::{Deref, DerefMut};
|
||||||
|
|
||||||
use toml::Value;
|
use toml::Value;
|
||||||
|
|
||||||
use task_hookrs::task::Task as TTask;
|
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.
|
/// 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
|
/// This Task struct is merely a wrapper for a `FileLockEntry`, therefore the function name
|
||||||
/// `into_filelockentry`.
|
/// `into_filelockentry`.
|
||||||
|
|
Loading…
Reference in a new issue