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

Adding minor change and implementing Cloning ability.

This commit is contained in:
neon_arch 2023-04-26 17:46:49 +03:00
parent fa1ea8d448
commit 28fee6b10a
2 changed files with 6 additions and 1 deletions

View File

@ -28,6 +28,7 @@ impl SearchResult {
}
}
#[derive(Clone)]
pub struct RawSearchResult {
pub title: String,
pub visiting_url: String,
@ -52,6 +53,10 @@ impl RawSearchResult {
pub fn add_engines(&mut self, engine: String) {
self.engine.push(engine)
}
pub fn engine(self) -> String {
self.engine.get(0).unwrap().to_string()
}
}
#[derive(Debug, Serialize)]

View File

@ -36,7 +36,7 @@ pub async fn aggregate(
result_map
.entry(key)
.and_modify(|result| {
result.add_engines(value.engine[0].clone());
result.add_engines(value.clone().engine());
})
.or_insert_with(|| -> RawSearchResult {
RawSearchResult::new(