1
Fork 0

Rollup merge of #94356 - Thomasdezeeuw:stabilize_unix_socket_creation, r=dtolnay

Rename unix::net::SocketAddr::from_path to from_pathname and stabilize it

Stabilizes `unix_socket_creation`.

Closes https://github.com/rust-lang/rust/issues/93423
r? `@m-ou-se`
This commit is contained in:
Dylan DPC 2022-03-11 03:32:03 +01:00 committed by GitHub
commit ab851653a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -140,12 +140,11 @@ impl SocketAddr {
/// # Examples /// # Examples
/// ///
/// ``` /// ```
/// #![feature(unix_socket_creation)]
/// use std::os::unix::net::SocketAddr; /// use std::os::unix::net::SocketAddr;
/// use std::path::Path; /// use std::path::Path;
/// ///
/// # fn main() -> std::io::Result<()> { /// # fn main() -> std::io::Result<()> {
/// let address = SocketAddr::from_path("/path/to/socket")?; /// let address = SocketAddr::from_pathname("/path/to/socket")?;
/// assert_eq!(address.as_pathname(), Some(Path::new("/path/to/socket"))); /// assert_eq!(address.as_pathname(), Some(Path::new("/path/to/socket")));
/// # Ok(()) /// # Ok(())
/// # } /// # }
@ -154,13 +153,12 @@ impl SocketAddr {
/// Creating a `SocketAddr` with a NULL byte results in an error. /// Creating a `SocketAddr` with a NULL byte results in an error.
/// ///
/// ``` /// ```
/// #![feature(unix_socket_creation)]
/// use std::os::unix::net::SocketAddr; /// use std::os::unix::net::SocketAddr;
/// ///
/// assert!(SocketAddr::from_path("/path/with/\0/bytes").is_err()); /// assert!(SocketAddr::from_pathname("/path/with/\0/bytes").is_err());
/// ``` /// ```
#[unstable(feature = "unix_socket_creation", issue = "93423")] #[stable(feature = "unix_socket_creation", since = "1.61.0")]
pub fn from_path<P>(path: P) -> io::Result<SocketAddr> pub fn from_pathname<P>(path: P) -> io::Result<SocketAddr>
where where
P: AsRef<Path>, P: AsRef<Path>,
{ {