@@ -10,7 +10,9 @@ use std::{
1010
1111use async_task:: { Runnable , Task } ;
1212use compio_buf:: IntoInner ;
13- use compio_driver:: { op:: Asyncify , Key , OpCode , Proactor , ProactorBuilder , PushEntry , RawFd } ;
13+ use compio_driver:: {
14+ op:: Asyncify , AsRawFd , Key , OpCode , Proactor , ProactorBuilder , PushEntry , RawFd ,
15+ } ;
1416use compio_log:: { debug, instrument} ;
1517use crossbeam_queue:: SegQueue ;
1618use futures_util:: { future:: Either , FutureExt } ;
@@ -57,10 +59,6 @@ impl RuntimeInner {
5759 } )
5860 }
5961
60- pub fn id ( & self ) -> usize {
61- self . id
62- }
63-
6462 // Safety: be careful about the captured lifetime.
6563 pub unsafe fn spawn_unchecked < F : Future > ( & self , future : F ) -> Task < F :: Output > {
6664 let runnables = self . runnables . clone ( ) ;
@@ -229,6 +227,12 @@ impl RuntimeInner {
229227 }
230228}
231229
230+ impl AsRawFd for RuntimeInner {
231+ fn as_raw_fd ( & self ) -> RawFd {
232+ self . driver . borrow ( ) . as_raw_fd ( )
233+ }
234+ }
235+
232236struct RuntimeContext {
233237 depth : usize ,
234238 ptr : Weak < RuntimeInner > ,
@@ -408,6 +412,12 @@ impl Runtime {
408412 }
409413}
410414
415+ impl AsRawFd for Runtime {
416+ fn as_raw_fd ( & self ) -> RawFd {
417+ self . inner . as_raw_fd ( )
418+ }
419+ }
420+
411421#[ cfg( feature = "criterion" ) ]
412422impl criterion:: async_executor:: AsyncExecutor for Runtime {
413423 fn block_on < T > ( & self , future : impl Future < Output = T > ) -> T {
0 commit comments