Merge pull request #983 from matthiasbeyer/libimagannotation/add-is_annotation
Libimagannotation/add is annotation
This commit is contained in:
commit
c71b70702c
1 changed files with 14 additions and 0 deletions
|
@ -40,6 +40,9 @@ pub trait Annotateable {
|
||||||
/// A new annotation also has the field `annotation.is_annotation` set to `true`.
|
/// A new annotation also has the field `annotation.is_annotation` set to `true`.
|
||||||
fn annotate<'a>(&mut self, store: &'a Store, ann_name: &str) -> Result<FileLockEntry<'a>>;
|
fn annotate<'a>(&mut self, store: &'a Store, ann_name: &str) -> Result<FileLockEntry<'a>>;
|
||||||
|
|
||||||
|
/// Check whether an entry is an annotation
|
||||||
|
fn is_annotation(&self) -> Result<bool>;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Annotateable for Entry {
|
impl Annotateable for Entry {
|
||||||
|
@ -66,5 +69,16 @@ impl Annotateable for Entry {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn is_annotation(&self) -> Result<bool> {
|
||||||
|
self.get_header()
|
||||||
|
.read("annotation.is_annotation")
|
||||||
|
.map_err_into(AEK::StoreReadError)
|
||||||
|
.and_then(|res| match res {
|
||||||
|
Some(Value::Boolean(b)) => Ok(b),
|
||||||
|
None => Ok(false),
|
||||||
|
_ => Err(AEK::HeaderTypeError.into_error()),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue