Skip to content

Commit c773db5

Browse files
committed
fix(runtime): runtime miss submit_with_flags function
1 parent 34bfd3c commit c773db5

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

compio-runtime/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@ pub mod time;
2222
pub use async_task::Task;
2323
pub use attacher::*;
2424
use compio_buf::BufResult;
25-
pub use runtime::{spawn, spawn_blocking, submit, JoinHandle, Runtime, RuntimeBuilder};
25+
pub use runtime::{
26+
spawn, spawn_blocking, submit, submit_with_flags, JoinHandle, Runtime, RuntimeBuilder,
27+
};

compio-runtime/src/runtime/mod.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,3 +471,16 @@ pub fn spawn_blocking<T: Send + 'static>(
471471
pub fn submit<T: OpCode + 'static>(op: T) -> impl Future<Output = BufResult<usize, T>> {
472472
Runtime::with_current(|r| r.submit(op))
473473
}
474+
475+
/// Submit an operation to the current runtime, and return a future for it with
476+
/// flags.
477+
///
478+
/// ## Panics
479+
///
480+
/// This method doesn't create runtime. It tries to obtain the current runtime
481+
/// by [`Runtime::with_current`].
482+
pub fn submit_with_flags<T: OpCode + 'static>(
483+
op: T,
484+
) -> impl Future<Output = (BufResult<usize, T>, u32)> {
485+
Runtime::with_current(|r| r.submit_with_flags(op))
486+
}

0 commit comments

Comments
 (0)