0
0
mirror of https://github.com/neon-mmd/websurfx.git synced 2024-11-22 05:58:21 -05:00

feat: add new check value for no engine selected (#227)

This commit is contained in:
neon_arch 2023-09-23 12:48:01 +03:00
parent 9271090851
commit b428cedd7a

View File

@ -122,6 +122,11 @@ pub struct SearchResults {
/// search query was filtered when the safe search level set to 3 and it
/// was present in the `Blocklist` file.
pub filtered: bool,
/// Stores the safe search level `safesearch` provided in the search url.
pub safe_search_level: u8,
/// Stores the flag option which holds the check value that whether any search engines were
/// selected or not.
pub no_engines_selected: bool,
}
impl SearchResults {
@ -147,6 +152,8 @@ impl SearchResults {
engine_errors_info: engine_errors_info.to_owned(),
disallowed: Default::default(),
filtered: Default::default(),
safe_search_level: Default::default(),
no_engines_selected: Default::default(),
}
}
@ -178,4 +185,19 @@ impl SearchResults {
pub fn results(&mut self) -> Vec<SearchResult> {
self.results.clone()
}
/// A setter function to set the current page safe search level.
pub fn set_safe_search_level(&mut self, safe_search_level: u8) {
self.safe_search_level = safe_search_level;
}
/// A getter function that gets the value of `no_engines_selected`.
pub fn no_engines_selected(&self) -> bool {
self.no_engines_selected
}
/// A setter function to set the `no_engines_selected` to true.
pub fn set_no_engines_selected(&mut self) {
self.no_engines_selected = true;
}
}