path2: Remove Path::normalize()

There are no clients of this API, so just remove it.

Update the module docstring to mention normalization.
This commit is contained in:
Kevin Ballard 2013-10-02 22:29:46 -07:00
parent eaec8a7132
commit ed539e1471
3 changed files with 5 additions and 8 deletions

View File

@ -43,6 +43,10 @@ Option<&str> with `.as_str()`. Similarly, attributes of the path can be queried
with methods such as `.filename()`. There are also methods that return a new
path instead of modifying the receiver, such as `.join()` or `.dir_path()`.
Paths are always kept in normalized form. This means that creating the path
`Path::from_str("a/b/../c")` will return the path `a/c`. Similarly any attempt
to mutate the path will always leave it in normalized form.
When rendering a path to some form of display, there is a method `.display()`
which is compatible with the `format!()` parameter `{}`. This will render the
path as a string, replacing all non-utf8 sequences with the Replacement

View File

@ -349,7 +349,7 @@ impl Path {
/// Returns a normalized byte vector representation of a path, by removing all empty
/// components, and unnecessary . and .. components.
pub fn normalize<V: Vector<u8>+CopyableVector<u8>>(v: V) -> ~[u8] {
fn normalize<V: Vector<u8>+CopyableVector<u8>>(v: V) -> ~[u8] {
// borrowck is being very picky
let val = {
let is_abs = !v.as_slice().is_empty() && v.as_slice()[0] == sep;

View File

@ -697,13 +697,6 @@ impl Path {
Some(self.repr)
}
/// Returns a normalized string representation of a path, by removing all empty
/// components, and unnecessary . and .. components.
pub fn normalize<S: Str>(s: S) -> ~str {
let (_, path) = Path::normalize_(s);
path
}
/// Returns an iterator that yields each component of the path in turn as a Option<&str>.
/// Every component is guaranteed to be Some.
/// Does not yield the path prefix (including server/share components in UNC paths).