Add StoreId::unstorified()

This commit is contained in:
Matthias Beyer 2016-07-02 17:54:35 +02:00
parent 12b8f8f331
commit 37380c84b9

View file

@ -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 {