Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/libstd/path/posix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ use c_str::{CString, ToCStr};
use clone::Clone;
use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering};
use collections::{Collection, MutableSeq};
use fmt;
use from_str::FromStr;
use hash;
use io::Writer;
use iter::{DoubleEndedIterator, AdditiveIterator, Extendable, Iterator, Map};
use option::{Option, None, Some};
use str::Str;
use str;
use string::String;
use slice::{CloneableVector, Splits, Slice, VectorVector,
ImmutablePartialEqSlice, ImmutableSlice};
use vec::Vec;
Expand Down Expand Up @@ -143,6 +145,12 @@ impl<'a> BytesContainer for &'a Path {
}
}

impl fmt::Show for Path {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
String::from_utf8_lossy( self.as_vec() ).as_slice().fmt(f)
}
}

impl GenericPathUnsafe for Path {
unsafe fn new_unchecked<T: BytesContainer>(path: T) -> Path {
let path = Path::normalize(path.container_as_bytes());
Expand Down
9 changes: 9 additions & 0 deletions src/libstd/path/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use c_str::{CString, ToCStr};
use clone::Clone;
use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering};
use collections::{Collection, MutableSeq};
use fmt;
use from_str::FromStr;
use hash;
use io::Writer;
Expand Down Expand Up @@ -186,6 +187,14 @@ impl<'a> BytesContainer for &'a Path {
fn is_str(_: Option<&'a Path>) -> bool { true }
}


impl fmt::Show for Path {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
String::from_utf8_lossy( self.as_vec() ).as_slice().fmt(f)
}
}


impl GenericPathUnsafe for Path {
/// See `GenericPathUnsafe::from_vec_unchecked`.
///
Expand Down