@@ -8,6 +8,10 @@ use tokio::sync::Notify;
8
8
use tokio:: time:: timeout;
9
9
use tokio_uring:: buf:: BoundedBuf ;
10
10
use tokio_uring:: buf:: BoundedBufMut ;
11
+ use tokio_uring:: fs:: File ;
12
+ use tokio_uring:: fs:: OpenOptions ;
13
+ use tokio_uring:: net:: TcpListener ;
14
+ use tokio_uring:: net:: TcpStream ;
11
15
use tokio_uring:: BufResult ;
12
16
use tokio_uring:: UnsubmittedWrite ;
13
17
@@ -34,7 +38,7 @@ pub trait Endpoint<E> {
34
38
fn write < T : BoundedBuf > ( & self , buf : T ) -> UnsubmittedWrite < T > ;
35
39
}
36
40
37
- impl Endpoint < tokio_uring :: fs :: File > for tokio_uring :: fs :: File {
41
+ impl Endpoint < File > for File {
38
42
async fn read < T : BoundedBufMut > ( & self , buf : T ) -> BufResult < usize , T > {
39
43
self . read_at ( buf, 0 ) . await
40
44
}
@@ -43,7 +47,7 @@ impl Endpoint<tokio_uring::fs::File> for tokio_uring::fs::File {
43
47
}
44
48
}
45
49
46
- impl Endpoint < tokio_uring :: net :: TcpStream > for tokio_uring :: net :: TcpStream {
50
+ impl Endpoint < TcpStream > for TcpStream {
47
51
async fn read < T : BoundedBufMut > ( & self , buf : T ) -> BufResult < usize , T > {
48
52
self . read ( buf) . await
49
53
}
@@ -129,7 +133,7 @@ pub async fn io_loop(
129
133
) -> Result < ( ) , Box < dyn std:: error:: Error > > {
130
134
info ! ( "{} 🛰️ Starting TCP server..." , NAME ) ;
131
135
let bind_addr = format ! ( "0.0.0.0:{}" , TCP_SERVER_PORT ) . parse ( ) . unwrap ( ) ;
132
- let listener = tokio_uring :: net :: TcpListener :: bind ( bind_addr) . unwrap ( ) ;
136
+ let listener = TcpListener :: bind ( bind_addr) . unwrap ( ) ;
133
137
info ! ( "{} 🛰️ TCP server bound to: <u>{}</u>" , NAME , bind_addr) ;
134
138
loop {
135
139
info ! ( "{} 💤 waiting for bluetooth handshake..." , NAME ) ;
@@ -159,7 +163,6 @@ pub async fn io_loop(
159
163
"{} 📂 Opening USB accessory device: <u>{}</u>" ,
160
164
NAME , USB_ACCESSORY_PATH
161
165
) ;
162
- use tokio_uring:: fs:: OpenOptions ;
163
166
let usb = OpenOptions :: new ( )
164
167
. read ( true )
165
168
. write ( true )
0 commit comments