21 lines
602 B
Rust
21 lines
602 B
Rust
#[derive(Debug)]
|
|||
|
|
pub struct S3Item {
|
||
|
|
pub key: String,
|
||
|
|
pub is_folder: bool,
|
||
|
|
pub folder_name: Option<String>,
|
||
|
|
pub size: Option<i64>,
|
||
|
|
pub last_modified: Option<String>,
|
||
|
|
}
|
||
|
|
|
||
|
|
impl std::fmt::Display for S3Item {
|
||
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||
|
|
let item_type = if self.is_folder { "[MAPPA]" } else { "[FÁJL]" };
|
||
|
|
let size_str = if let Some(size) = self.size {
|
||
|
|
format!("{} bytes", size)
|
||
|
|
} else {
|
||
|
|
"-".to_string()
|
||
|
|
};
|
||
|
|
write!(f, "{} {} (méret: {})", item_type, self.key, size_str)
|
||
|
|
}
|
||
|
|
}
|