Skip to content

Commit f8d3dcf

Browse files
committed
Introduce Submit trait and add Link struct for linked operations
1 parent 350f637 commit f8d3dcf

File tree

19 files changed

+175
-47
lines changed

19 files changed

+175
-47
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ io-uring = "0.6.0"
2424
socket2 = { version = "0.4.4", features = ["all"] }
2525
bytes = { version = "1.0", optional = true }
2626
futures-util = { version = "0.3.26", default-features = false, features = ["std"] }
27+
pin-project-lite = "0.2.13"
2728

2829
[dev-dependencies]
2930
tempfile = "3.2.0"

examples/cat.rs

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

6-
use tokio_uring::fs::File;
6+
use tokio_uring::{fs::File, Submit};
77

88
fn main() {
99
// The file to `cat` is passed as a CLI argument

examples/mix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
use std::env;
66

7-
use tokio_uring::{fs::File, net::TcpListener};
7+
use tokio_uring::{fs::File, net::TcpListener, Submit};
88

99
fn main() {
1010
// The file to serve over TCP is passed as a CLI argument

examples/tcp_stream.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{env, net::SocketAddr};
22

3-
use tokio_uring::net::TcpStream;
3+
use tokio_uring::{net::TcpStream, Submit};
44

55
fn main() {
66
let args: Vec<_> = env::args().collect();

examples/unix_listener.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::env;
22

3-
use tokio_uring::net::UnixListener;
3+
use tokio_uring::{net::UnixListener, Submit};
44

55
fn main() {
66
let args: Vec<_> = env::args().collect();

examples/unix_stream.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::env;
22

3-
use tokio_uring::net::UnixStream;
3+
use tokio_uring::{net::UnixStream, Submit};
44

55
fn main() {
66
let args: Vec<_> = env::args().collect();

examples/wrk-bench.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::io;
22
use std::rc::Rc;
33
use tokio::task::JoinHandle;
4+
use tokio_uring::Submit;
45

56
pub const RESPONSE: &'static [u8] =
67
b"HTTP/1.1 200 OK\nContent-Type: text/plain\nContent-Length: 12\n\nHello world!";

src/fs/file.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::buf::{BoundedBuf, BoundedBufMut, IoBuf, IoBufMut, Slice};
33
use crate::fs::OpenOptions;
44
use crate::io::SharedFd;
55

6-
use crate::runtime::driver::op::Op;
6+
use crate::runtime::driver::op::{Op, Submit};
77
use crate::{UnsubmittedOneshot, UnsubmittedRead, UnsubmittedWrite};
88
use std::fmt;
99
use std::io;
@@ -32,6 +32,7 @@ use std::path::Path;
3232
///
3333
/// ```no_run
3434
/// use tokio_uring::fs::File;
35+
/// use tokio_uring::Submit;
3536
///
3637
/// fn main() -> Result<(), Box<dyn std::error::Error>> {
3738
/// tokio_uring::start(async {
@@ -158,6 +159,7 @@ impl File {
158159
///
159160
/// ```no_run
160161
/// use tokio_uring::fs::File;
162+
/// use tokio_uring::Submit;
161163
///
162164
/// fn main() -> Result<(), Box<dyn std::error::Error>> {
163165
/// tokio_uring::start(async {
@@ -518,6 +520,7 @@ impl File {
518520
///
519521
/// ```no_run
520522
/// use tokio_uring::fs::File;
523+
/// use tokio_uring::Submit;
521524
///
522525
/// fn main() -> Result<(), Box<dyn std::error::Error>> {
523526
/// tokio_uring::start(async {
@@ -767,6 +770,7 @@ impl File {
767770
///
768771
/// ```no_run
769772
/// use tokio_uring::fs::File;
773+
/// use tokio_uring::Submit;
770774
///
771775
/// fn main() -> Result<(), Box<dyn std::error::Error>> {
772776
/// tokio_uring::start(async {
@@ -804,6 +808,7 @@ impl File {
804808
///
805809
/// ```no_run
806810
/// use tokio_uring::fs::File;
811+
/// use tokio_uring::Submit;
807812
///
808813
/// fn main() -> Result<(), Box<dyn std::error::Error>> {
809814
/// tokio_uring::start(async {

src/io/socket.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::io::write::UnsubmittedWrite;
2-
use crate::runtime::driver::op::Op;
2+
use crate::runtime::driver::op::{Op, Submit};
33
use crate::{
44
buf::fixed::FixedBuf,
55
buf::{BoundedBuf, BoundedBufMut, IoBuf, Slice},

src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
//!
1111
//! ```no_run
1212
//! use tokio_uring::fs::File;
13+
//! use tokio_uring::Submit;
1314
//!
1415
//! fn main() -> Result<(), Box<dyn std::error::Error>> {
1516
//! tokio_uring::start(async {
@@ -80,7 +81,9 @@ pub mod net;
8081

8182
pub use io::read::*;
8283
pub use io::write::*;
83-
pub use runtime::driver::op::{InFlightOneshot, OneshotOutputTransform, UnsubmittedOneshot};
84+
pub use runtime::driver::op::{
85+
InFlightOneshot, OneshotOutputTransform, Submit, UnsubmittedOneshot,
86+
};
8487
pub use runtime::spawn;
8588
pub use runtime::Runtime;
8689

@@ -106,6 +109,7 @@ use std::future::Future;
106109
///
107110
/// ```no_run
108111
/// use tokio_uring::fs::File;
112+
/// use tokio_uring::Submit;
109113
///
110114
/// fn main() -> Result<(), Box<dyn std::error::Error>> {
111115
/// tokio_uring::start(async {
@@ -245,6 +249,7 @@ impl Builder {
245249
///
246250
/// ```no_run
247251
/// use tokio_uring::fs::File;
252+
/// use tokio_uring::Submit;
248253
///
249254
/// fn main() -> Result<(), Box<dyn std::error::Error>> {
250255
/// tokio_uring::start(async {

0 commit comments

Comments
 (0)