Skip to content

Commit 390b68d

Browse files
committed
Add socklen_t type alias
1 parent 6ebb23c commit 390b68d

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ compile_error!("Socket2 doesn't support the compile target");
185185

186186
use sys::c_int;
187187

188-
pub use sockaddr::SockAddr;
188+
pub use sockaddr::{socklen_t, SockAddr};
189189
pub use socket::Socket;
190190
pub use sockref::SockRef;
191191

src/sockaddr.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@ use std::{fmt, io, ptr};
88
use windows_sys::Win32::Networking::WinSock::SOCKADDR_IN6_0;
99

1010
use crate::sys::{
11-
c_int, sa_family_t, sockaddr, sockaddr_in, sockaddr_in6, sockaddr_storage, socklen_t, AF_INET,
12-
AF_INET6, AF_UNIX,
11+
c_int, sa_family_t, sockaddr, sockaddr_in, sockaddr_in6, sockaddr_storage, AF_INET, AF_INET6,
12+
AF_UNIX,
1313
};
1414
use crate::Domain;
1515

16+
/// The integer type used with `getsockname` on this platform.
17+
#[allow(non_camel_case_types)]
18+
pub type socklen_t = crate::sys::socklen_t;
19+
1620
/// The address of a socket.
1721
///
1822
/// `SockAddr`s may be constructed directly to and from the standard library

0 commit comments

Comments
 (0)