File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ pub mod fs;
7979pub mod net;
8080
8181pub use runtime:: spawn;
82+ pub use runtime:: Runtime ;
8283
8384use std:: future:: Future ;
8485
@@ -140,7 +141,7 @@ use std::future::Future;
140141/// }
141142/// ```
142143pub fn start < F : Future > ( future : F ) -> F :: Output {
143- let mut rt = runtime:: Runtime :: new ( & builder ( ) ) . unwrap ( ) ;
144+ let rt = runtime:: Runtime :: new ( & builder ( ) ) . unwrap ( ) ;
144145 rt. block_on ( future)
145146}
146147
@@ -225,7 +226,7 @@ impl Builder {
225226 /// }
226227 /// ```
227228 pub fn start < F : Future > ( & self , future : F ) -> F :: Output {
228- let mut rt = runtime:: Runtime :: new ( self ) . unwrap ( ) ;
229+ let rt = runtime:: Runtime :: new ( self ) . unwrap ( ) ;
229230 rt. block_on ( future)
230231 }
231232}
Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ use std::io;
66use tokio:: io:: unix:: AsyncFd ;
77use tokio:: task:: LocalSet ;
88
9- pub ( crate ) struct Runtime {
9+ /// The Runtime executor
10+ pub struct Runtime {
1011 /// io-uring driver
1112 driver : AsyncFd < Driver > ,
1213
@@ -48,7 +49,8 @@ pub fn spawn<T: std::future::Future + 'static>(task: T) -> tokio::task::JoinHand
4849}
4950
5051impl Runtime {
51- pub ( crate ) fn new ( b : & crate :: Builder ) -> io:: Result < Runtime > {
52+ /// Create a new tokio_uring runtime on the current thread
53+ pub fn new ( b : & crate :: Builder ) -> io:: Result < Runtime > {
5254 let rt = tokio:: runtime:: Builder :: new_current_thread ( )
5355 . on_thread_park ( || {
5456 CURRENT . with ( |x| {
@@ -68,7 +70,8 @@ impl Runtime {
6870 Ok ( Runtime { driver, local, rt } )
6971 }
7072
71- pub ( crate ) fn block_on < F > ( & mut self , future : F ) -> F :: Output
73+ /// Runs a future to completion on the current runtime
74+ pub fn block_on < F > ( & self , future : F ) -> F :: Output
7275 where
7376 F : Future ,
7477 {
You can’t perform that action at this time.
0 commit comments