Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix use order #105

Merged
merged 9 commits into from
Dec 12, 2024
2 changes: 1 addition & 1 deletion src/lib/drivers/fake.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use bytes::{BufMut, BytesMut};
use std::sync::Arc;

use anyhow::Result;
use bytes::{BufMut, BytesMut};
use mavlink_codec::{v2::V2Packet, Packet};
use tokio::sync::{broadcast, RwLock};
use tracing::*;
Expand Down
3 changes: 1 addition & 2 deletions src/lib/drivers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,12 @@ mod tests {
use tokio::sync::RwLock;
use tracing::*;

use super::*;
use crate::{
callbacks::{Callbacks, MessageCallback},
stats::{accumulated::driver::AccumulatedDriverStats, driver::DriverUuid},
};

use super::*;

#[test]
fn test_unique_endpoints() {
let mut unique_types = HashSet::new();
Expand Down
5 changes: 2 additions & 3 deletions src/lib/hub/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ mod protocol;

use std::sync::{Arc, Mutex};

use actor::HubActor;
use anyhow::Result;
use indexmap::IndexMap;
use lazy_static::lazy_static;
use protocol::HubCommand;
use tokio::sync::{broadcast, mpsc, oneshot, RwLock};

use crate::{
Expand All @@ -21,9 +23,6 @@ use crate::{
},
};

use actor::HubActor;
use protocol::HubCommand;

lazy_static! {
static ref HUB: Hub = Hub::new(
10000,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ use std::{
sync::{Arc, Mutex},
};

use crate::cli;

use lazy_static::lazy_static;
use ringbuffer::{AllocRingBuffer, RingBuffer};
use tokio::sync::broadcast::{Receiver, Sender};
Expand All @@ -16,6 +14,8 @@ use tracing_subscriber::{
EnvFilter, Layer,
};

use crate::cli;

struct BroadcastWriter {
sender: Sender<String>,
}
Expand Down
3 changes: 1 addition & 2 deletions src/lib/stats/accumulated/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ use std::sync::Arc;
use indexmap::IndexMap;
use serde::Serialize;

use crate::{drivers::DriverInfo, protocol::Protocol, stats::driver::DriverUuid};

use super::AccumulatedStatsInner;
use crate::{drivers::DriverInfo, protocol::Protocol, stats::driver::DriverUuid};

pub type AccumulatedDriversStats = IndexMap<DriverUuid, AccumulatedDriverStats>;

Expand Down
3 changes: 1 addition & 2 deletions src/lib/stats/accumulated/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ use std::sync::Arc;
use indexmap::IndexMap;
use serde::Serialize;

use super::AccumulatedStatsInner;
use crate::{
protocol::Protocol,
stats::messages::{ComponentId, MessageId, SystemId},
};

use super::AccumulatedStatsInner;

#[derive(Default, Clone, Debug, Serialize)]
pub struct AccumulatedHubMessagesStats {
pub systems_messages_stats: IndexMap<SystemId, AccumulatedSystemMessagesStats>,
Expand Down
9 changes: 4 additions & 5 deletions src/lib/stats/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@ mod protocol;

use std::sync::{Arc, Mutex};

use anyhow::Result;
use lazy_static::lazy_static;
use serde::Serialize;
use tokio::sync::{mpsc, oneshot};

use accumulated::AccumulatedStatsInner;
use actor::StatsActor;
use anyhow::Result;
use driver::DriversStats;
use lazy_static::lazy_static;
use messages::HubMessagesStats;
use protocol::StatsCommand;
use serde::Serialize;
use tokio::sync::{mpsc, oneshot};

lazy_static! {
static ref STATS: Stats = Stats::new(tokio::time::Duration::from_secs(1));
Expand Down
3 changes: 1 addition & 2 deletions src/lib/stats/protocol.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use anyhow::Result;
use tokio::sync::{mpsc, oneshot};

use crate::stats::{DriversStats, StatsInner};

use super::messages::HubMessagesStats;
use crate::stats::{DriversStats, StatsInner};

pub enum StatsCommand {
SetPeriod {
Expand Down
3 changes: 1 addition & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use anyhow::*;
use tracing::*;

use mavlink_server::{cli, hub, logger, web};
use tracing::*;

#[tokio::main(flavor = "multi_thread", worker_threads = 10)]
async fn main() -> Result<()> {
Expand Down
Loading