mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
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:
commit
ab851653a5
@ -140,12 +140,11 @@ impl SocketAddr {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(unix_socket_creation)]
|
||||
/// use std::os::unix::net::SocketAddr;
|
||||
/// use std::path::Path;
|
||||
///
|
||||
/// # 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")));
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
@ -154,13 +153,12 @@ impl SocketAddr {
|
||||
/// Creating a `SocketAddr` with a NULL byte results in an error.
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(unix_socket_creation)]
|
||||
/// 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")]
|
||||
pub fn from_path<P>(path: P) -> io::Result<SocketAddr>
|
||||
#[stable(feature = "unix_socket_creation", since = "1.61.0")]
|
||||
pub fn from_pathname<P>(path: P) -> io::Result<SocketAddr>
|
||||
where
|
||||
P: AsRef<Path>,
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user