feat(file): Added implementation for strict to better data view in strict
This commit is contained in:
1 parent
b814314503
commit
1e1d452b66
1 file changed
+20
@@ -22,6 +22,25 @@ pub struct FileInfo {
|
||||
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;
|
||||
|
||||
/// === Модуль для операций синхронизации ===
|
||||
@@ -68,6 +87,7 @@ pub struct DeleteOptions {
|
||||
}
|
||||
|
||||
pub mod sync;
|
||||
|
||||
/// === Модуль для поиска ===
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
|
||||
Reference in new issue
Block a user