change names and add docsrs stuff

This commit is contained in:
Noah Kennedy
2023-10-20 14:18:03 -05:00
parent 64ae8c373b
commit c63ee40879
4 changed files with 28 additions and 4 deletions
+8 -1
View File
@@ -246,9 +246,16 @@ impl<T: AsRawFd> AsyncFd<T> {
/// Create a new AsyncFd with the provided raw epoll flags for registration.
///
/// These flags replace any epoll flags would normally set when registering the fd.
///
/// **Note**: This is an [unstable API][unstable]. The public API of this may break in 1.x
/// releases.
/// See [the documentation on unstable features][unstable] for details.
///
/// [unstable]: crate#unstable-features
#[track_caller]
#[cfg(all(target_os = "linux", tokio_unstable))]
pub fn with_flags(inner: T, flags: u32) -> io::Result<Self>
#[cfg_attr(docsrs, doc(cfg(tokio_unstable)), doc(cfg(target_os = "linux")))]
pub fn with_epoll_flags(inner: T, flags: u32) -> io::Result<Self>
where
T: AsRawFd,
{
+11 -1
View File
@@ -243,9 +243,19 @@ impl TcpListener {
/// Create a new TcpListener with the provided raw epoll flags.
///
/// These flags replace any epoll flags would normally set when registering the fd.
///
/// **Note**: This is an [unstable API][unstable]. The public API of this may break in 1.x
/// releases.
/// See [the documentation on unstable features][unstable] for details.
///
/// [unstable]: crate#unstable-features
#[track_caller]
#[cfg(all(target_os = "linux", tokio_unstable))]
pub fn from_std_with_flags(listener: net::TcpListener, flags: u32) -> io::Result<TcpListener> {
#[cfg_attr(docsrs, doc(cfg(tokio_unstable)), doc(cfg(target_os = "linux")))]
pub fn from_std_with_epoll_flags(
listener: net::TcpListener,
flags: u32,
) -> io::Result<TcpListener> {
let io = mio::net::TcpListener::from_std(listener);
let io = PollEvented::new_raw(io, flags)?;
Ok(TcpListener { io })
+8 -1
View File
@@ -117,9 +117,16 @@ impl UnixListener {
/// Create a new UnixListener with the provided raw epoll flags.
///
/// These flags replace any epoll flags would normally set when registering the fd.
///
/// **Note**: This is an [unstable API][unstable]. The public API of this may break in 1.x
/// releases.
/// See [the documentation on unstable features][unstable] for details.
///
/// [unstable]: crate#unstable-features
#[track_caller]
#[cfg(all(target_os = "linux", tokio_unstable))]
pub fn from_std_with_flags(
#[cfg_attr(docsrs, doc(cfg(tokio_unstable)), doc(cfg(target_os = "linux")))]
pub fn from_std_with_epoll_flags(
listener: net::UnixListener,
flags: u32,
) -> io::Result<UnixListener> {
+1 -1
View File
@@ -84,7 +84,7 @@ fn count_accepts(std: std::net::TcpListener, flags: u32, barrier: Arc<Barrier>)
rt.block_on(async {
std.set_nonblocking(true).unwrap();
let listener = tokio::net::TcpListener::from_std_with_flags(std, flags).unwrap();
let listener = tokio::net::TcpListener::from_std_with_epoll_flags(std, flags).unwrap();
barrier.wait().await;