Add Is::remove_isflag() for removing header flags
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
parent
96a25c18b2
commit
19912f5e88
1 changed files with 9 additions and 0 deletions
|
@ -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(|_| ())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue