pub struct FileSuggestion {
pub path: String,
pub score: f64,
pub is_directory: bool,
}
impl FileSuggestion {
pub fn new(path: &str, score: f64) -> Self {
Self {
path: path.to_string(),
score,
is_directory: path.ends_with('/') || path.ends_with('\\'),
}
}
pub fn directory(path: &str, score: f64) -> Self {
Self {
path: path.to_string(),
score,
is_directory: true,
}
}
pub fn file(path: &str, score: f64) -> Self {
Self {
path: path.to_string(),
score,
is_directory: false,
}
}
}