Skip to content

Commit

Permalink
src: drivers: Reorganize imports
Browse files Browse the repository at this point in the history
  • Loading branch information
joaoantoniocardoso committed Sep 6, 2024
1 parent 60112ce commit 22fb6b4
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 25 deletions.
4 changes: 1 addition & 3 deletions src/drivers/fake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ use tokio::sync::broadcast;
use tracing::*;

use crate::{
drivers::{Driver, DriverInfo},
drivers::{Driver, DriverInfo, OnMessageCallback, OnMessageCallbackExt},
protocol::{read_all_messages, Protocol},
};

use super::{OnMessageCallback, OnMessageCallbackExt};

#[derive(Default)]
pub struct FakeSink {
on_message: OnMessageCallback<Arc<Protocol>>,
Expand Down
6 changes: 4 additions & 2 deletions src/drivers/file/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ use std::path::PathBuf;
use tokio::sync::broadcast;
use tracing::*;

use crate::drivers::{Driver, DriverExt, DriverInfo, OnMessageCallback, OnMessageCallbackExt};
use crate::protocol::Protocol;
use crate::{
drivers::{Driver, DriverExt, DriverInfo, OnMessageCallback, OnMessageCallbackExt},
protocol::Protocol,
};

pub struct FileServer {
pub path: PathBuf,
Expand Down
13 changes: 8 additions & 5 deletions src/drivers/tcp/client.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
use std::sync::Arc;

use crate::drivers::tcp::{tcp_receive_task, tcp_send_task};
use crate::protocol::Protocol;
use anyhow::Result;
use tokio::net::TcpStream;
use tokio::sync::broadcast;
use tokio::{net::TcpStream, sync::broadcast};
use tracing::*;

use crate::drivers::{Driver, DriverExt, DriverInfo};
use crate::{
drivers::{
tcp::{tcp_receive_task, tcp_send_task},
Driver, DriverExt, DriverInfo,
},
protocol::Protocol,
};

pub struct TcpClient {
pub remote_addr: String,
Expand Down
16 changes: 11 additions & 5 deletions src/drivers/tcp/server.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
use std::sync::Arc;

use crate::drivers::tcp::{tcp_receive_task, tcp_send_task};
use crate::protocol::Protocol;
use anyhow::Result;
use tokio::net::{TcpListener, TcpStream};
use tokio::sync::broadcast;
use tokio::{
net::{TcpListener, TcpStream},
sync::broadcast,
};
use tracing::*;

use crate::drivers::{Driver, DriverExt, DriverInfo};
use crate::{
drivers::{
tcp::{tcp_receive_task, tcp_send_task},
Driver, DriverExt, DriverInfo,
},
protocol::Protocol,
};

pub struct TcpServer {
pub local_addr: String,
Expand Down
12 changes: 7 additions & 5 deletions src/drivers/udp/client.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
use crate::protocol::{read_all_messages, Protocol};
use anyhow::Result;
use std::sync::Arc;
use tokio::net::UdpSocket;
use tokio::sync::broadcast;

use anyhow::Result;
use tokio::{net::UdpSocket, sync::broadcast};
use tracing::*;

use crate::drivers::{Driver, DriverExt, DriverInfo};
use crate::{
drivers::{Driver, DriverExt, DriverInfo},
protocol::{read_all_messages, Protocol},
};

pub struct UdpClient {
pub remote_addr: String,
Expand Down
15 changes: 10 additions & 5 deletions src/drivers/udp/server.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
use anyhow::Result;
use std::{collections::HashMap, sync::Arc};
use tokio::net::UdpSocket;
use tokio::sync::{broadcast, RwLock};

use anyhow::Result;
use tokio::{
net::UdpSocket,
sync::{broadcast, RwLock},
};
use tracing::*;

use crate::drivers::{Driver, DriverExt, DriverInfo};
use crate::protocol::{read_all_messages, Protocol};
use crate::{
drivers::{Driver, DriverExt, DriverInfo},
protocol::{read_all_messages, Protocol},
};

pub struct UdpServer {
pub local_addr: String,
Expand Down

0 comments on commit 22fb6b4

Please sign in to comment.