Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a154ea0

Browse files
authored
Merge branch 'master' into refactor/quic/endpoint
2 parents 4ce88b4 + b441a98 commit a154ea0

18 files changed

Lines changed: 104 additions & 76 deletions

File tree

compio-fs/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ rustdoc-args = ["--cfg", "docsrs"]
1919
compio-buf = { workspace = true }
2020
compio-driver = { workspace = true }
2121
compio-io = { workspace = true }
22-
compio-runtime = { workspace = true }
22+
compio-runtime = { workspace = true, features = ["async-fd"] }
2323

2424
cfg-if = { workspace = true }
2525
pin-project-lite = { workspace = true }

compio-fs/src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,16 @@ pub use stdio::*;
3030
mod utils;
3131
pub use utils::*;
3232

33-
mod async_fd;
34-
pub use async_fd::*;
35-
3633
#[cfg(windows)]
3734
pub mod named_pipe;
3835

3936
#[cfg(unix)]
4037
pub mod pipe;
4138

39+
/// Providing functionalities to wait for readiness.
40+
#[deprecated(since = "0.12.0", note = "Use `compio_runtime::fd::AsyncFd` instead")]
41+
pub type AsyncFd<T> = compio_runtime::fd::AsyncFd<T>;
42+
4243
#[cfg(unix)]
4344
pub(crate) fn path_string(path: impl AsRef<std::path::Path>) -> std::io::Result<std::ffi::CString> {
4445
use std::os::unix::ffi::OsStrExt;

compio-fs/src/named_pipe.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use compio_io::{
1212
AsyncRead, AsyncReadAt, AsyncReadManaged, AsyncReadManagedAt, AsyncWrite, AsyncWriteAt,
1313
util::Splittable,
1414
};
15-
use compio_runtime::{BorrowedBuffer, BufferPool};
15+
use compio_runtime::{BorrowedBuffer, BufferPool, fd::AsyncFd};
1616
use widestring::U16CString;
1717
use windows_sys::Win32::{
1818
Storage::FileSystem::{
@@ -29,7 +29,7 @@ use windows_sys::Win32::{
2929
},
3030
};
3131

32-
use crate::{AsyncFd, File, OpenOptions};
32+
use crate::{File, OpenOptions};
3333

3434
/// A [Windows named pipe] server.
3535
///

compio-fs/src/stdio/unix.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ use std::io;
33
use compio_buf::{BufResult, IoBuf, IoBufMut, IoVectoredBuf, IoVectoredBufMut};
44
use compio_driver::{AsFd, AsRawFd, BorrowedFd, RawFd};
55
use compio_io::{AsyncRead, AsyncReadManaged, AsyncWrite};
6-
use compio_runtime::{BorrowedBuffer, BufferPool};
6+
use compio_runtime::{BorrowedBuffer, BufferPool, fd::AsyncFd};
77

88
#[cfg(doc)]
99
use super::{stderr, stdin, stdout};
10-
use crate::AsyncFd;
1110

1211
#[derive(Debug)]
1312
struct StaticFd(RawFd);

compio-net/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
mod cmsg;
1717
mod opts;
18-
mod poll_fd;
1918
mod resolve;
2019
mod socket;
2120
pub(crate) mod split;
@@ -24,8 +23,10 @@ mod udp;
2423
mod unix;
2524

2625
pub use cmsg::*;
26+
/// Providing functionalities to wait for readiness.
27+
#[deprecated(since = "0.12.0", note = "Use `compio_runtime::fd::PollFd` instead")]
28+
pub type PollFd<T> = compio_runtime::fd::PollFd<T>;
2729
pub use opts::SocketOpts;
28-
pub use poll_fd::*;
2930
pub use resolve::ToSocketAddrsAsync;
3031
pub(crate) use resolve::{each_addr, first_addr_buf};
3132
pub(crate) use socket::*;

compio-net/src/socket.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@ use compio_driver::{
1616
},
1717
syscall,
1818
};
19-
use compio_runtime::{Attacher, BorrowedBuffer, BufferPool};
19+
use compio_runtime::{Attacher, BorrowedBuffer, BufferPool, fd::PollFd};
2020
use socket2::{Domain, Protocol, SockAddr, Socket as Socket2, Type};
2121

22-
use crate::PollFd;
23-
2422
#[derive(Debug, Clone)]
2523
pub struct Socket {
2624
pub(crate) socket: Attacher<Socket2>,

compio-net/src/tcp.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ use std::{future::Future, io, net::SocketAddr};
33
use compio_buf::{BufResult, IoBuf, IoBufMut, IoVectoredBuf, IoVectoredBufMut};
44
use compio_driver::impl_raw_fd;
55
use compio_io::{AsyncRead, AsyncReadManaged, AsyncWrite, util::Splittable};
6-
use compio_runtime::{BorrowedBuffer, BufferPool};
6+
use compio_runtime::{BorrowedBuffer, BufferPool, fd::PollFd};
77
use socket2::{Protocol, SockAddr, Socket as Socket2, Type};
88

99
use crate::{
10-
OwnedReadHalf, OwnedWriteHalf, PollFd, ReadHalf, Socket, SocketOpts, ToSocketAddrsAsync,
11-
WriteHalf,
10+
OwnedReadHalf, OwnedWriteHalf, ReadHalf, Socket, SocketOpts, ToSocketAddrsAsync, WriteHalf,
1211
};
1312

1413
/// A TCP socket server, listening for connections.

compio-net/src/unix.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ use std::{future::Future, io, path::Path};
33
use compio_buf::{BufResult, IoBuf, IoBufMut, IoVectoredBuf, IoVectoredBufMut};
44
use compio_driver::impl_raw_fd;
55
use compio_io::{AsyncRead, AsyncReadManaged, AsyncWrite, util::Splittable};
6-
use compio_runtime::{BorrowedBuffer, BufferPool};
6+
use compio_runtime::{BorrowedBuffer, BufferPool, fd::PollFd};
77
use socket2::{SockAddr, Socket as Socket2, Type};
88

9-
use crate::{OwnedReadHalf, OwnedWriteHalf, PollFd, ReadHalf, Socket, SocketOpts, WriteHalf};
9+
use crate::{OwnedReadHalf, OwnedWriteHalf, ReadHalf, Socket, SocketOpts, WriteHalf};
1010

1111
/// A Unix socket server, listening for connections.
1212
///

compio-net/tests/poll.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::{
33
net::{Ipv4Addr, SocketAddrV4},
44
};
55

6-
use compio_net::PollFd;
6+
use compio_runtime::fd::PollFd;
77
use socket2::{Domain, Protocol, SockAddr, Socket, Type};
88

99
fn is_would_block(e: &io::Error) -> bool {

compio-runtime/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ rustdoc-args = ["--cfg", "docsrs"]
1919
compio-driver = { workspace = true }
2020
compio-buf = { workspace = true }
2121
compio-log = { workspace = true }
22+
compio-io = { workspace = true, optional = true }
2223

2324
async-task = "4.5.0"
2425
cfg-if = { workspace = true, optional = true }
@@ -50,6 +51,7 @@ block2 = "0.6.0"
5051
[features]
5152
event = ["dep:cfg-if", "compio-buf/arrayvec"]
5253
time = []
54+
async-fd = ["dep:compio-io"]
5355

5456
# Enable it to always notify the driver when a task schedules.
5557
notify-always = []

0 commit comments

Comments
 (0)