From ea4487a481ced6ddbd21727084682fcac7a1e7ee Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Thu, 30 Jun 2016 11:02:58 +0200 Subject: [PATCH] Impl Display for StoreId --- libimagstore/src/storeid.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libimagstore/src/storeid.rs b/libimagstore/src/storeid.rs index 147b80cb..ce999893 100644 --- a/libimagstore/src/storeid.rs +++ b/libimagstore/src/storeid.rs @@ -4,7 +4,7 @@ use std::borrow::Borrow; use std::ops::Deref; use semver::Version; -use std::fmt::{Debug, Formatter}; +use std::fmt::{Display, Debug, Formatter}; use std::fmt::Error as FmtError; use std::result::Result as RResult; @@ -24,6 +24,17 @@ impl Into 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, ""), // TODO: Sure here? + } + } + +} + impl Deref for StoreId { type Target = PathBuf;