INNER CODE UNIT · Rust

extension

szabodanika/microbin · src/pasta.rs:64

    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>,
    #[serde(default)]
    pub attachments: Option<Vec<PastaFile>>,
    pub extension: String,
    pub private: bool,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…