Add StoreId::unstorified()
This commit is contained in:
parent
12b8f8f331
commit
37380c84b9
1 changed files with 8 additions and 0 deletions
|
@ -9,6 +9,7 @@ use std::fmt::Error as FmtError;
|
||||||
use std::result::Result as RResult;
|
use std::result::Result as RResult;
|
||||||
|
|
||||||
use error::StoreErrorKind as SEK;
|
use error::StoreErrorKind as SEK;
|
||||||
|
use error::MapErrInto;
|
||||||
use store::Result;
|
use store::Result;
|
||||||
use store::Store;
|
use store::Store;
|
||||||
|
|
||||||
|
@ -26,6 +27,13 @@ impl StoreId {
|
||||||
StoreId::from(new_id)
|
StoreId::from(new_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn unstorified(self, store: &Store) -> Result<StoreId> {
|
||||||
|
self.strip_prefix(store.path())
|
||||||
|
.map(PathBuf::from)
|
||||||
|
.map(StoreId::from)
|
||||||
|
.map_err_into(SEK::StoreIdHandlingError)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Into<PathBuf> for StoreId {
|
impl Into<PathBuf> for StoreId {
|
||||||
|
|
Loading…
Reference in a new issue