INNER CODE UNIT · Rust
embeddable
szabodanika/microbin · src/pasta.rs:60
pub fn embeddable(&self) -> bool {
self.is_image() || self.is_video()
}
pub fn extension(&self) -> String {
std::path::Path::new(&self.name)
.extension()
.and_then(std::ffi::OsStr::to_str)
.unwrap_or("FILE")
.to_uppercase()
}
}
#[derive(Serialize, Deserialize, Debug)]
pub struct Pasta {
pub id: u64,
pub content: String,
pub file: Option<PastaFile>,