Impl Display for StoreId
This commit is contained in:
parent
80a198523a
commit
ea4487a481
1 changed files with 12 additions and 1 deletions
|
@ -4,7 +4,7 @@ use std::borrow::Borrow;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
use semver::Version;
|
use semver::Version;
|
||||||
use std::fmt::{Debug, Formatter};
|
use std::fmt::{Display, Debug, Formatter};
|
||||||
use std::fmt::Error as FmtError;
|
use std::fmt::Error as FmtError;
|
||||||
use std::result::Result as RResult;
|
use std::result::Result as RResult;
|
||||||
|
|
||||||
|
@ -24,6 +24,17 @@ impl Into<PathBuf> for StoreId {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Display for StoreId {
|
||||||
|
|
||||||
|
fn fmt(&self, fmt: &mut Formatter) -> RResult<(), FmtError> {
|
||||||
|
match self.0.to_str() {
|
||||||
|
Some(s) => write!(fmt, "{}", s),
|
||||||
|
None => write!(fmt, "<non-UTF8-StoreId>"), // TODO: Sure here?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
impl Deref for StoreId {
|
impl Deref for StoreId {
|
||||||
type Target = PathBuf;
|
type Target = PathBuf;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue