diff --git a/src/main.rs b/src/main.rs index e6e3289..2cba43f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,7 +21,12 @@ async fn main() -> Result<(), Box> { let mut index = 0usize; let mut wrap = |module| { - let tile = tile::Tile::new(index, sender.clone(), Uuid::new_v4().to_string().into(), module); + let tile = tile::Tile::new( + index, + sender.clone(), + Uuid::new_v4().to_string().into(), + module, + ); index += 1; tile }; diff --git a/src/tile.rs b/src/tile.rs index a3f590c..23225b4 100644 --- a/src/tile.rs +++ b/src/tile.rs @@ -85,7 +85,10 @@ pub struct TileData { #[async_trait] pub trait TileModule: Send + std::fmt::Debug { - async fn run(&mut self, sender: &mut BlockSender) -> Result<(), Box>; + async fn run( + &mut self, + sender: &mut BlockSender, + ) -> Result<(), Box>; } #[derive(Debug)] @@ -113,7 +116,12 @@ pub struct Tile { } impl Tile { - pub fn new(sender_id: usize, sender: Sender, instance: Arc, module: Box) -> Self { + pub fn new( + sender_id: usize, + sender: Sender, + instance: Arc, + module: Box, + ) -> Self { Tile { sender: BlockSender { sender_id, @@ -124,8 +132,6 @@ impl Tile { } } pub fn spawn(mut self) -> JoinHandle>> { - tokio::spawn(async move { - self.module.run(&mut self.sender).await - }) + tokio::spawn(async move { self.module.run(&mut self.sender).await }) } -} \ No newline at end of file +} diff --git a/src/tiles/hostname.rs b/src/tiles/hostname.rs index 494c5be..d07670c 100644 --- a/src/tiles/hostname.rs +++ b/src/tiles/hostname.rs @@ -14,7 +14,10 @@ impl Hostname { #[async_trait] impl TileModule for Hostname { - async fn run(&mut self, sender: &mut BlockSender) -> Result<(), Box> { + async fn run( + &mut self, + sender: &mut BlockSender, + ) -> Result<(), Box> { let mut raw = String::new(); File::open("/proc/sys/kernel/hostname") .await? diff --git a/src/tiles/load.rs b/src/tiles/load.rs index 09d4cea..524fd31 100644 --- a/src/tiles/load.rs +++ b/src/tiles/load.rs @@ -16,7 +16,10 @@ impl Load { #[async_trait] impl TileModule for Load { - async fn run(&mut self, sender: &mut BlockSender) -> Result<(), Box> { + async fn run( + &mut self, + sender: &mut BlockSender, + ) -> Result<(), Box> { let mut timer = interval(Duration::from_secs(5)); loop { timer.tick().await; diff --git a/src/tiles/memory.rs b/src/tiles/memory.rs index 5031a7f..f5ddea2 100644 --- a/src/tiles/memory.rs +++ b/src/tiles/memory.rs @@ -54,7 +54,10 @@ impl Memory { #[async_trait] impl TileModule for Memory { - async fn run(&mut self, sender: &mut BlockSender) -> Result<(), Box> { + async fn run( + &mut self, + sender: &mut BlockSender, + ) -> Result<(), Box> { let mut timer = interval(Duration::from_secs(5)); let mut raw = [0u8; 256]; loop { diff --git a/src/tiles/time.rs b/src/tiles/time.rs index a315574..5f42d70 100644 --- a/src/tiles/time.rs +++ b/src/tiles/time.rs @@ -37,7 +37,10 @@ impl Default for Time { #[async_trait] impl TileModule for Time { - async fn run(&mut self, sender: &mut BlockSender) -> Result<(), Box> { + async fn run( + &mut self, + sender: &mut BlockSender, + ) -> Result<(), Box> { let mut time = Local::now(); loop { sender.send(self.send_time(time)).await?;