feat(file): Added implementation for strict to better data view in strict

This commit is contained in:
Black_Raven committed 2026-03-02 16:46:13 +03:00
1 parent b814314503
commit 1e1d452b66
1 file changed
+20
+20
View File
@@ -22,6 +22,25 @@ pub struct FileInfo {
pub modified: Option<String>, pub modified: Option<String>,
} }
impl FileInfo {
pub fn format_size(&self) -> String {
let bytes = self.size;
if bytes < 1024 {
format!("{} B", bytes)
} else if bytes < 1024 * 1024 {
format!("{:.1} KB", bytes as f64 / 1024.0)
} else if bytes < 1024 * 1024 * 1024 {
format!("{:.1} MB", bytes as f64 / (1024.0 * 1024.0))
} else {
format!("{:.2} GB", bytes as f64 / (1024.0 * 1024.0 * 1024.0))
}
}
pub fn icon(&self) -> &'static str {
if self.is_dir { "📁" } else { "📄" }
}
}
pub mod files; pub mod files;
/// === Модуль для операций синхронизации === /// === Модуль для операций синхронизации ===
@@ -68,6 +87,7 @@ pub struct DeleteOptions {
} }
pub mod sync; pub mod sync;
/// === Модуль для поиска === /// === Модуль для поиска ===
#[derive(Debug, Default)] #[derive(Debug, Default)]