mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
Use resolve.conf as example for Path ends_with
This commit is contained in:
parent
3d1388f514
commit
446fccf1b8
@ -2109,14 +2109,14 @@ impl 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("etc/passwd"));
|
||||
/// assert!(path.ends_with("/etc/passwd"));
|
||||
/// assert!(path.ends_with("resolv.conf"));
|
||||
/// assert!(path.ends_with("etc/resolv.conf"));
|
||||
/// assert!(path.ends_with("/etc/resolv.conf"));
|
||||
///
|
||||
/// assert!(!path.ends_with("/passwd"));
|
||||
/// assert!(!path.ends_with("wd")); // use .extension() instead
|
||||
/// assert!(!path.ends_with("/resolv.conf"));
|
||||
/// assert!(!path.ends_with("conf")); // use .extension() instead
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn ends_with<P: AsRef<Path>>(&self, child: P) -> bool {
|
||||
|
Loading…
Reference in New Issue
Block a user