Improve code quality

This commit is contained in:
Mubelotix 2025-06-24 11:38:11 +02:00
parent 59a1c5d9a7
commit 4a179fb3c0
No known key found for this signature in database
GPG key ID: 89F391DBCC8CE7F0
9 changed files with 25 additions and 48 deletions

View file

@ -25,15 +25,15 @@ pub struct Progress {
#[derive(Default)]
pub struct EmbedderStats {
pub errors: Arc<RwLock<(Option<String>, u32)>>,
pub total_requests: AtomicUsize
pub total_count: AtomicUsize
}
impl std::fmt::Debug for EmbedderStats {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let (error, count) = self.errors.read().unwrap().clone();
f.debug_struct("EmbedderStats")
.field("errors", &error)
.field("total_requests", &self.total_requests.load(Ordering::Relaxed))
.field("last_error", &error)
.field("total_count", &self.total_count.load(Ordering::Relaxed))
.field("error_count", &count)
.finish()
}