pub const DEFAULT_REMOTE_LIMIT: usize = 10; #[derive(Clone, Debug, Eq, PartialEq)] pub enum SearchInstallStatus { Available, Installed { installed_version: Option, }, UpdateAvailable { installed_version: Option, latest_version: Option, }, } #[derive(Clone, Debug, Eq, PartialEq)] pub struct SearchQuery { pub text: String, pub remote_limit: usize, } impl SearchQuery { pub fn new(text: &str) -> Self { Self { text: text.to_owned(), remote_limit: DEFAULT_REMOTE_LIMIT, } } pub fn with_remote_limit(text: &str, remote_limit: usize) -> Self { Self { text: text.to_owned(), remote_limit, } } } #[derive(Clone, Debug, Eq, PartialEq)] pub struct SearchResult { pub provider_id: String, pub display_name: String, pub description: Option, pub source_locator: String, pub install_query: String, pub canonical_locator: String, pub version: Option, pub install_status: SearchInstallStatus, } #[derive(Clone, Debug, Eq, PartialEq)] pub struct InstalledSearchMatch { pub stable_id: String, pub display_name: String, pub installed_version: Option, } #[derive(Clone, Debug, Eq, PartialEq)] pub struct SearchWarning { pub provider_id: Option, pub message: String, } #[derive(Clone, Debug, Eq, PartialEq)] pub struct SearchResults { pub query_text: String, pub remote_hits: Vec, pub installed_matches: Vec, pub warnings: Vec, }