mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-26 00:00:16 +02:00
change names and add docsrs stuff
This commit is contained in:
@@ -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,
|
||||
{
|
||||
|
||||
@@ -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 })
|
||||
|
||||
@@ -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> {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user