From c7898d361762749d4522e26fa9c1695bf44a0ed4 Mon Sep 17 00:00:00 2001 From: Richo Healey Date: Sun, 4 May 2014 23:47:04 -0700 Subject: [PATCH] libstd: impl Show for Path --- src/libstd/path/posix.rs | 7 +++++++ src/libstd/path/windows.rs | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs index 99a281755e4e0..d1f5384696813 100644 --- a/src/libstd/path/posix.rs +++ b/src/libstd/path/posix.rs @@ -23,6 +23,7 @@ use str::Str; use slice::{CloneableVector, Splits, Vector, VectorVector, ImmutableEqVector, OwnedVector, ImmutableVector}; use vec::Vec; +use fmt; use super::{BytesContainer, GenericPath, GenericPathUnsafe}; @@ -71,6 +72,12 @@ impl Eq for Path { } } +impl fmt::Show for Path { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f.buf, "{}", str::from_utf8(self.repr.as_slice()).unwrap()) + } +} + impl TotalEq for Path {} impl FromStr for Path { diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index 758a76167cdef..20001e67c15fb 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -24,6 +24,7 @@ use slice::{Vector, OwnedVector, ImmutableVector}; use str::{CharSplits, Str, StrVector, StrSlice}; use strbuf::StrBuf; use vec::Vec; +use fmt; use super::{contains_nul, BytesContainer, GenericPath, GenericPathUnsafe}; @@ -95,6 +96,12 @@ impl Eq for Path { } } +impl fmt::Show for Path { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f.buf, "{}", self.repr) + } +} + impl TotalEq for Path {} impl FromStr for Path {