Skip to content

Commit 03875ed

Browse files
committed
io_uring: cosmetics with use
1 parent 25d6bd7 commit 03875ed

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/io_uring.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ use tokio::sync::Notify;
88
use tokio::time::timeout;
99
use tokio_uring::buf::BoundedBuf;
1010
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;
1115
use tokio_uring::BufResult;
1216
use tokio_uring::UnsubmittedWrite;
1317

@@ -34,7 +38,7 @@ pub trait Endpoint<E> {
3438
fn write<T: BoundedBuf>(&self, buf: T) -> UnsubmittedWrite<T>;
3539
}
3640

37-
impl Endpoint<tokio_uring::fs::File> for tokio_uring::fs::File {
41+
impl Endpoint<File> for File {
3842
async fn read<T: BoundedBufMut>(&self, buf: T) -> BufResult<usize, T> {
3943
self.read_at(buf, 0).await
4044
}
@@ -43,7 +47,7 @@ impl Endpoint<tokio_uring::fs::File> for tokio_uring::fs::File {
4347
}
4448
}
4549

46-
impl Endpoint<tokio_uring::net::TcpStream> for tokio_uring::net::TcpStream {
50+
impl Endpoint<TcpStream> for TcpStream {
4751
async fn read<T: BoundedBufMut>(&self, buf: T) -> BufResult<usize, T> {
4852
self.read(buf).await
4953
}
@@ -129,7 +133,7 @@ pub async fn io_loop(
129133
) -> Result<(), Box<dyn std::error::Error>> {
130134
info!("{} 🛰️ Starting TCP server...", NAME);
131135
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();
133137
info!("{} 🛰️ TCP server bound to: <u>{}</u>", NAME, bind_addr);
134138
loop {
135139
info!("{} 💤 waiting for bluetooth handshake...", NAME);
@@ -159,7 +163,6 @@ pub async fn io_loop(
159163
"{} 📂 Opening USB accessory device: <u>{}</u>",
160164
NAME, USB_ACCESSORY_PATH
161165
);
162-
use tokio_uring::fs::OpenOptions;
163166
let usb = OpenOptions::new()
164167
.read(true)
165168
.write(true)

0 commit comments

Comments
 (0)