treewide: set up rustfmt and taplo with custom rules

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I794f9152bb02e3dd91c9738369b94fc66a6a6964
This commit is contained in:
raf 2026-02-19 01:42:28 +03:00
commit ffae695240
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
27 changed files with 1851 additions and 1618 deletions

View file

@ -1,5 +1,5 @@
[package]
name = "pscand-cli"
name = "pscand-cli"
version.workspace = true
edition.workspace = true
license.workspace = true
@ -10,20 +10,20 @@ name = "pscand"
path = "src/main.rs"
[dependencies]
pscand-core.workspace = true
chrono.workspace = true
clap.workspace = true
dirs.workspace = true
env_logger.workspace = true
libloading.workspace = true
log.workspace = true
parking_lot.workspace = true
pscand-core.workspace = true
pscand-macros.workspace = true
tokio.workspace = true
serde.workspace = true
serde_json.workspace = true
toml.workspace = true
libloading.workspace = true
chrono.workspace = true
log.workspace = true
env_logger.workspace = true
thiserror.workspace = true
parking_lot.workspace = true
ringbuf.workspace = true
dirs.workspace = true
sysinfo.workspace = true
clap.workspace = true
sha2.workspace = true
ringbuf.workspace = true
serde.workspace = true
serde_json.workspace = true
sha2.workspace = true
sysinfo.workspace = true
thiserror.workspace = true
tokio.workspace = true
toml.workspace = true

View file

@ -1,19 +1,45 @@
#![allow(improper_ctypes_definitions)]
use std::{
fs,
io::Read,
path::{
Path,
PathBuf,
},
sync::{
atomic::{
AtomicBool,
Ordering,
},
Arc,
},
time::{
Duration,
Instant,
SystemTime,
UNIX_EPOCH,
},
};
use clap::Parser;
use libloading::Library;
use pscand_core::Config as CoreConfig;
use pscand_core::logging::{LogLevel, RingBufferLogger};
use pscand_core::scanner::Scanner;
use sha2::{Digest, Sha256};
use std::fs;
use std::io::Read;
use std::path::{Path, PathBuf};
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering};
use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH};
use tokio::sync::RwLock;
use tokio::time::interval;
use pscand_core::{
logging::{
LogLevel,
RingBufferLogger,
},
scanner::Scanner,
Config as CoreConfig,
};
use sha2::{
Digest,
Sha256,
};
use tokio::{
sync::RwLock,
time::interval,
};
type ScannerCreator = pscand_core::ScannerCreatorFfi;
@ -79,22 +105,22 @@ fn verify_library(path: &Path) -> Result<(), String> {
}
struct LoadedScanner {
name: String,
scanner: Arc<RwLock<Box<dyn Scanner>>>,
name: String,
scanner: Arc<RwLock<Box<dyn Scanner>>>,
interval: Duration,
#[allow(dead_code)]
library: Library,
library: Library,
}
#[derive(Clone)]
struct DaemonState {
running: Arc<AtomicBool>,
running: Arc<AtomicBool>,
shutdown_requested: Arc<AtomicBool>,
start_time: Arc<RwLock<SystemTime>>,
last_collection: Arc<RwLock<SystemTime>>,
collection_count: Arc<RwLock<u64>>,
error_count: Arc<RwLock<u64>>,
heartbeat_path: PathBuf,
start_time: Arc<RwLock<SystemTime>>,
last_collection: Arc<RwLock<SystemTime>>,
collection_count: Arc<RwLock<u64>>,
error_count: Arc<RwLock<u64>>,
heartbeat_path: PathBuf,
}
impl DaemonState {
@ -334,7 +360,8 @@ async fn run_daemon(args: RunArgs) -> Result<(), Box<dyn std::error::Error>> {
" 1. Scanner plugins are installed in one of the configured directories"
);
log::error!(
" 2. Scanner directories are correctly set in config file or PSCAND_SCANNER_DIRS env var"
" 2. Scanner directories are correctly set in config file or \
PSCAND_SCANNER_DIRS env var"
);
log::error!(" 3. Scanners are not disabled in the configuration");
logger.log(
@ -664,7 +691,8 @@ async fn list_scanners() -> Result<(), Box<dyn std::error::Error>> {
"\nDynamic scanners are loaded from $PSCAND_SCANNER_DIRS (colon-separated)"
);
println!(
" Default fallback: ~/.local/share/pscand/scanners/ or ~/.config/pscand/scanners/"
" Default fallback: ~/.local/share/pscand/scanners/ or \
~/.config/pscand/scanners/"
);
Ok(())
}