30 lines
800 B
Rust
30 lines
800 B
Rust
|
|
#[derive(Debug, Clone)]
|
|
pub enum SearchType {
|
|
Normal,
|
|
Author,
|
|
Source,
|
|
}
|
|
|
|
impl SearchType {
|
|
pub fn from_str(s: &str) -> (Self, String) {
|
|
match s {
|
|
i @ _ if i.starts_with("source:") =>
|
|
(Self::Source, i.strip_prefix("source:").unwrap_or("").to_string().to_lowercase()),
|
|
i @ _ if i.starts_with("author:") =>
|
|
(Self::Author, i.strip_prefix("author:").unwrap_or("").to_string().to_lowercase()),
|
|
i @ _ => (Self::Normal, i.to_string().to_lowercase())
|
|
}
|
|
}
|
|
}
|
|
|
|
pub fn super_separator(ui: &mut egui::Ui, color: egui::Color32, width: f32, height: f32) {
|
|
egui::Frame::none()
|
|
.fill(color)
|
|
.show(ui, |ui| {
|
|
ui.set_width(width);
|
|
ui.set_height(height);
|
|
});
|
|
}
|
|
|