1
Fork 0

Use resolve.conf as example for Path ends_with

This commit is contained in:
Ivan Tham 2020-08-15 17:25:07 +08:00 committed by GitHub
parent 3d1388f514
commit 446fccf1b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2109,14 +2109,14 @@ impl Path {
/// ``` /// ```
/// use std::path::Path; /// use std::path::Path;
/// ///
/// let path = Path::new("/etc/passwd"); /// let path = Path::new("/etc/resolv.conf");
/// ///
/// assert!(path.ends_with("passwd")); /// assert!(path.ends_with("resolv.conf"));
/// assert!(path.ends_with("etc/passwd")); /// assert!(path.ends_with("etc/resolv.conf"));
/// assert!(path.ends_with("/etc/passwd")); /// assert!(path.ends_with("/etc/resolv.conf"));
/// ///
/// assert!(!path.ends_with("/passwd")); /// assert!(!path.ends_with("/resolv.conf"));
/// assert!(!path.ends_with("wd")); // use .extension() instead /// assert!(!path.ends_with("conf")); // use .extension() instead
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn ends_with<P: AsRef<Path>>(&self, child: P) -> bool { pub fn ends_with<P: AsRef<Path>>(&self, child: P) -> bool {