strip garbage
This commit is contained in:
parent
d5524d7eae
commit
6567af268e
36 changed files with 496 additions and 2434 deletions
|
@ -35,7 +35,7 @@ impl SearchResult {
|
|||
///
|
||||
/// * `title` - The title of the search result.
|
||||
/// * `url` - The url which is accessed when clicked on it
|
||||
/// (href url in html in simple words).
|
||||
/// (href url in html in simple words).
|
||||
/// * `description` - The description of the search result.
|
||||
/// * `engine` - The names of the upstream engines from which this results were provided.
|
||||
pub fn new(title: &str, url: &str, description: &str, engine: &[&str]) -> Self {
|
||||
|
@ -125,7 +125,7 @@ impl EngineErrorInfo {
|
|||
/// # Arguments
|
||||
///
|
||||
/// * `error` - It takes the error type which occured while fetching the result from a particular
|
||||
/// search engine.
|
||||
/// search engine.
|
||||
/// * `engine` - It takes the name of the engine that failed to provide the requested search results.
|
||||
pub fn new(error: &EngineError, engine: &str) -> Self {
|
||||
Self {
|
||||
|
@ -178,11 +178,11 @@ impl SearchResults {
|
|||
/// # Arguments
|
||||
///
|
||||
/// * `results` - Takes an argument of individual serializable `SearchResult` struct
|
||||
/// and stores it into a vector of `SearchResult` structs.
|
||||
/// and stores it into a vector of `SearchResult` structs.
|
||||
/// * `page_query` - Takes an argument of current page`s search query `q` provided in
|
||||
/// the search url.
|
||||
/// the search url.
|
||||
/// * `engine_errors_info` - Takes an array of structs which contains information regarding
|
||||
/// which engines failed with their names, reason and their severity color name.
|
||||
/// which engines failed with their names, reason and their severity color name.
|
||||
pub fn new(results: Vec<SearchResult>, engine_errors_info: &[EngineErrorInfo]) -> Self {
|
||||
Self {
|
||||
results,
|
||||
|
|
|
@ -146,7 +146,6 @@ pub trait SearchEngine: Sync + Send {
|
|||
page: u32,
|
||||
user_agent: &str,
|
||||
client: &Client,
|
||||
safe_search: u8,
|
||||
) -> Result<Vec<(String, SearchResult)>, EngineError>;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
/// order to allow the deserializing the json back to struct in aggregate function in
|
||||
/// aggregator.rs and create a new struct out of it and then serialize it back to json and pass
|
||||
/// it to the template files.
|
||||
#[derive(Default)]
|
||||
#[derive(Default, Debug, Clone)]
|
||||
pub struct Style {
|
||||
/// It stores the parsed theme option used to set a theme for the website.
|
||||
pub theme: String,
|
||||
|
@ -29,7 +29,7 @@ impl Style {
|
|||
///
|
||||
/// * `theme` - It takes the parsed theme option used to set a theme for the website.
|
||||
/// * `colorscheme` - It takes the parsed colorscheme option used to set a colorscheme
|
||||
/// for the theme being used.
|
||||
/// for the theme being used.
|
||||
pub fn new(theme: String, colorscheme: String, animation: Option<String>) -> Self {
|
||||
Style {
|
||||
theme,
|
||||
|
|
|
@ -30,19 +30,16 @@ pub struct Cookie<'a> {
|
|||
pub colorscheme: Cow<'a, str>,
|
||||
/// It stores the user selected upstream search engines selected from the UI.
|
||||
pub engines: Cow<'a, Vec<Cow<'a, str>>>,
|
||||
/// It stores the user selected safe search level from the UI.
|
||||
pub safe_search_level: u8,
|
||||
}
|
||||
|
||||
impl<'a> Cookie<'a> {
|
||||
/// server_models::Cookie contructor function
|
||||
pub fn build(style: &'a Style, mut engines: Vec<Cow<'a, str>>, safe_search_level: u8) -> Self {
|
||||
pub fn build(style: &'a Style, mut engines: Vec<Cow<'a, str>>) -> Self {
|
||||
engines.sort();
|
||||
Self {
|
||||
theme: Cow::Borrowed(&style.theme),
|
||||
colorscheme: Cow::Borrowed(&style.colorscheme),
|
||||
engines: Cow::Owned(engines),
|
||||
safe_search_level,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue