Minor doc cleanup.
This commit is contained in:
parent
8651011b6f
commit
59291eb197
1 changed files with 12 additions and 11 deletions
|
@ -58,10 +58,10 @@ pub fn PosixPath(s: &str) -> PosixPath {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait GenericPath : Clone + Eq + ToStr {
|
pub trait GenericPath : Clone + Eq + ToStr {
|
||||||
/// Converts a string to a Path
|
/// Converts a string to a path.
|
||||||
fn from_str(&str) -> Self;
|
fn from_str(&str) -> Self;
|
||||||
|
|
||||||
/// Returns the directory component of `self`, as a string
|
/// Returns the directory component of `self`, as a string.
|
||||||
fn dirname(&self) -> ~str {
|
fn dirname(&self) -> ~str {
|
||||||
let s = self.dir_path().to_str();
|
let s = self.dir_path().to_str();
|
||||||
match s.len() {
|
match s.len() {
|
||||||
|
@ -152,17 +152,17 @@ pub trait GenericPath : Clone + Eq + ToStr {
|
||||||
/// If `self` names a directory, returns the empty path.
|
/// If `self` names a directory, returns the empty path.
|
||||||
fn file_path(&self) -> Self;
|
fn file_path(&self) -> Self;
|
||||||
|
|
||||||
/// Returns a new Path whose parent directory is `self` and whose
|
/// Returns a new path whose parent directory is `self` and whose
|
||||||
/// file component is the given string.
|
/// file component is the given string.
|
||||||
fn push(&self, (&str)) -> Self;
|
fn push(&self, (&str)) -> Self;
|
||||||
|
|
||||||
/// Returns a new Path consisting of the given path, made relative to `self`.
|
/// Returns a new path consisting of the given path, made relative to `self`.
|
||||||
fn push_rel(&self, other: &Self) -> Self {
|
fn push_rel(&self, other: &Self) -> Self {
|
||||||
assert!(!other.is_absolute());
|
assert!(!other.is_absolute());
|
||||||
self.push_many(other.components())
|
self.push_many(other.components())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a new Path consisting of the path given by the given vector
|
/// Returns a new path consisting of the path given by the given vector
|
||||||
/// of strings, relative to `self`.
|
/// of strings, relative to `self`.
|
||||||
fn push_many<S: Str>(&self, (&[S])) -> Self;
|
fn push_many<S: Str>(&self, (&[S])) -> Self;
|
||||||
|
|
||||||
|
@ -174,9 +174,9 @@ pub trait GenericPath : Clone + Eq + ToStr {
|
||||||
/// contain directory separators in any of its components.
|
/// contain directory separators in any of its components.
|
||||||
fn unsafe_join(&self, (&Self)) -> Self;
|
fn unsafe_join(&self, (&Self)) -> Self;
|
||||||
|
|
||||||
/// On Unix, always returns false. On Windows, returns true iff `self`'s
|
/// On Unix, always returns `false`. On Windows, returns `true` iff `self`'s
|
||||||
/// file stem is one of: `con` `aux` `com1` `com2` `com3` `com4`
|
/// file stem is one of: `con` `aux` `com1` `com2` `com3` `com4`
|
||||||
/// `lpt1` `lpt2` `lpt3` `prn` `nul`
|
/// `lpt1` `lpt2` `lpt3` `prn` `nul`.
|
||||||
fn is_restricted(&self) -> bool;
|
fn is_restricted(&self) -> bool;
|
||||||
|
|
||||||
/// Returns a new path that names the same file as `self`, without containing
|
/// Returns a new path that names the same file as `self`, without containing
|
||||||
|
@ -187,7 +187,8 @@ pub trait GenericPath : Clone + Eq + ToStr {
|
||||||
/// Returns `true` if `self` is an absolute path.
|
/// Returns `true` if `self` is an absolute path.
|
||||||
fn is_absolute(&self) -> bool;
|
fn is_absolute(&self) -> bool;
|
||||||
|
|
||||||
/// True if `self` is an ancestor of `other`. See `test_is_ancestor_of` for examples
|
/// True if `self` is an ancestor of `other`.
|
||||||
|
// See `test_is_ancestor_of` for examples.
|
||||||
fn is_ancestor_of(&self, other: &Self) -> bool {
|
fn is_ancestor_of(&self, other: &Self) -> bool {
|
||||||
debug!("%s / %s %? %?", self.to_str(), other.to_str(), self.is_absolute(),
|
debug!("%s / %s %? %?", self.to_str(), other.to_str(), self.is_absolute(),
|
||||||
self.components().len());
|
self.components().len());
|
||||||
|
@ -197,7 +198,7 @@ pub trait GenericPath : Clone + Eq + ToStr {
|
||||||
self.is_ancestor_of(&other.pop()))
|
self.is_ancestor_of(&other.pop()))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Find the relative path from one file to another
|
/// Finds the relative path from one file to another.
|
||||||
fn get_relative_to(&self, abs2: (&Self)) -> Self {
|
fn get_relative_to(&self, abs2: (&Self)) -> Self {
|
||||||
assert!(self.is_absolute());
|
assert!(self.is_absolute());
|
||||||
assert!(abs2.is_absolute());
|
assert!(abs2.is_absolute());
|
||||||
|
@ -516,7 +517,7 @@ impl PosixPath {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Execute a function on p as well as all of its ancestors
|
/// Executes a function `f` on `self` as well as on all of its ancestors.
|
||||||
pub fn each_parent(&self, f: &fn(&Path)) {
|
pub fn each_parent(&self, f: &fn(&Path)) {
|
||||||
if !self.components.is_empty() {
|
if !self.components.is_empty() {
|
||||||
f(self);
|
f(self);
|
||||||
|
@ -618,7 +619,7 @@ impl WindowsPath {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Execute a function on p as well as all of its ancestors
|
/// Executes a function `f` on `self` as well as on all of its ancestors.
|
||||||
pub fn each_parent(&self, f: &fn(&Path)) {
|
pub fn each_parent(&self, f: &fn(&Path)) {
|
||||||
if !self.components.is_empty() {
|
if !self.components.is_empty() {
|
||||||
f(self);
|
f(self);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue