about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorUlrik Sverdrup <root@localhost>2015-05-11 00:29:50 +0200
committerUlrik Sverdrup <root@localhost>2015-05-11 03:41:53 +0200
commit02b8e4e6cf6f3fc3a7d31f348fc82bafa0165e3a (patch)
treec1e9ab1cf809dd4a1e5c1930fa3b5efd44ec4d87 /src
parent4e8afd65f93f1c351365c71f4461a2c6728f8287 (diff)
downloadrust-02b8e4e6cf6f3fc3a7d31f348fc82bafa0165e3a.tar.gz
rust-02b8e4e6cf6f3fc3a7d31f348fc82bafa0165e3a.zip
docs: Clarify Path::starts_with (and ends_with)
Fixes #24882
Diffstat (limited to 'src')
-rw-r--r--src/libstd/path.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libstd/path.rs b/src/libstd/path.rs
index 8ccc387c902..21f873e6877 100644
--- a/src/libstd/path.rs
+++ b/src/libstd/path.rs
@@ -1449,6 +1449,8 @@ impl Path {
 
     /// Determines whether `base` is a prefix of `self`.
     ///
+    /// Only considers whole path components to match.
+    ///
     /// # Examples
     ///
     /// ```
@@ -1457,6 +1459,8 @@ impl Path {
     /// let path = Path::new("/etc/passwd");
     ///
     /// assert!(path.starts_with("/etc"));
+    ///
+    /// assert!(!path.starts_with("/e"));
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn starts_with<P: AsRef<Path>>(&self, base: P) -> bool {
@@ -1465,6 +1469,8 @@ impl Path {
 
     /// Determines whether `child` is a suffix of `self`.
     ///
+    /// Only considers whole path components to match.
+    ///
     /// # Examples
     ///
     /// ```