Skip to content

Commit d3656df

Browse files
committed
Move SockAddr::unix to the top of the impl block
To make it easier to discover.
1 parent 6c95ce4 commit d3656df

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/sockaddr.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ pub struct SockAddr {
2424

2525
#[allow(clippy::len_without_is_empty)]
2626
impl SockAddr {
27+
/// Constructs a `SockAddr` with the family `AF_UNIX` and the provided path.
28+
///
29+
/// Returns an error if the path is longer than `SUN_LEN`.
30+
pub fn unix<P>(path: P) -> io::Result<SockAddr>
31+
where
32+
P: AsRef<Path>,
33+
{
34+
crate::sys::unix_sockaddr(path.as_ref())
35+
}
36+
2737
/// Create a `SockAddr` from the underlying storage and its length.
2838
///
2939
/// # Safety
@@ -228,16 +238,6 @@ impl SockAddr {
228238
_ => None,
229239
}
230240
}
231-
232-
/// Constructs a `SockAddr` with the family `AF_UNIX` and the provided path.
233-
///
234-
/// Returns an error if the path is longer than `SUN_LEN`.
235-
pub fn unix<P>(path: P) -> io::Result<SockAddr>
236-
where
237-
P: AsRef<Path>,
238-
{
239-
crate::sys::unix_sockaddr(path.as_ref())
240-
}
241241
}
242242

243243
impl From<SocketAddr> for SockAddr {

0 commit comments

Comments
 (0)