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:
parent
fa1ea8d448
commit
28fee6b10a
@ -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)]
|
||||
|
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user