1 2 3 4 5 6 7 8 9 10 11 12
use std::path::PathBuf; pub enum ImageLocation { File(PathBuf), Clipboard, } impl From<Option<PathBuf>> for ImageLocation { fn from(path: Option<PathBuf>) -> Self { path.map_or(ImageLocation::Clipboard, ImageLocation::File) } }