diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2018-11-15 18:25:58 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2019-02-11 03:22:56 +0100 |
commit | 19912f5e88bf0c0f1a1c521f6f5109ee6fac8cff (patch) | |
tree | cc42b63ce5f941c37f64d7c819fb1d60d632ab9a /lib | |
parent | 96a25c18b2506852fa512922400466cf4062310f (diff) |
Add Is::remove_isflag() for removing header flags
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/entry/libimagentryutil/src/isa.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/entry/libimagentryutil/src/isa.rs b/lib/entry/libimagentryutil/src/isa.rs index ba634c9c..835fb5e7 100644 --- a/lib/entry/libimagentryutil/src/isa.rs +++ b/lib/entry/libimagentryutil/src/isa.rs @@ -23,6 +23,7 @@ use failure::Error; use toml::Value; use toml_query::read::TomlValueReadTypeExt; use toml_query::insert::TomlValueInsertExt; +use toml_query::delete::TomlValueDeleteExt; /// Trait to check whether an entry is a certain kind of entry /// @@ -71,6 +72,7 @@ use toml_query::insert::TomlValueInsertExt; pub trait Is { fn is<T: IsKindHeaderPathProvider>(&self) -> Result<bool>; fn set_isflag<T: IsKindHeaderPathProvider>(&mut self) -> Result<()>; + fn remove_isflag<T: IsKindHeaderPathProvider>(&mut self) -> Result<()>; } impl Is for ::libimagstore::store::Entry { @@ -89,6 +91,13 @@ impl Is for ::libimagstore::store::Entry { .map_err(Error::from) .map(|_| ()) } + + fn remove_isflag<T: IsKindHeaderPathProvider>(&mut self) -> Result<()> { + self.get_header_mut() + .delete(T::kindflag_header_location()) + .map_err(Error::from) + .map(|_| ()) + } } |