Skip to content

Commit

Permalink
fix new parser lib
Browse files Browse the repository at this point in the history
  • Loading branch information
KappaShilaff committed Jul 18, 2022
1 parent f2067a0 commit a41ff3b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
7 changes: 5 additions & 2 deletions src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ impl RawCache {
self.0.write().await.push(raw);
}

pub async fn get_raws(&self, last_timestamp_block: i32) -> (Vec<RawTransaction>, Vec<(i32, i64)>) {
pub async fn get_raws(
&self,
last_timestamp_block: i32,
) -> (Vec<RawTransaction>, Vec<(i32, i64)>) {
let mut lock = self.0.write().await;

let (res, cache) =
Expand All @@ -50,7 +53,7 @@ impl RawCache {
Ordering::Equal => x.data.lt.cmp(&y.data.lt),
Ordering::Greater => Ordering::Greater,
})
.fold((vec![], vec![]), |(mut raws, mut times), x| {
.fold((vec![], vec![]), |(mut raws, mut times), x| {
times.push((x.data.now as i32, x.data.lt as i64));
raws.push(x);
(raws, times)
Expand Down
18 changes: 9 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ pub fn test_from_raw_transactions(
let (functions, events) = from_any_extractable_to_functions_events(events_to_parse);

let parser = TransactionParser::builder()
.function_in_list(&functions, false)
.functions_out_list(&functions, false)
.events_list(&events)
.function_in_list(functions.clone(), false)
.functions_out_list(functions, false)
.events_list(events)
.build()
.unwrap();

Expand Down Expand Up @@ -104,9 +104,9 @@ async fn parse_kafka_transactions(
let (functions, events) = from_any_extractable_to_functions_events(config.events_to_parse);

let parser = TransactionParser::builder()
.function_in_list(&functions, false)
.functions_out_list(&functions, false)
.events_list(&events)
.function_in_list(functions.clone(), false)
.functions_out_list(functions, false)
.events_list(events)
.build()
.unwrap();

Expand Down Expand Up @@ -332,9 +332,9 @@ pub fn extract_events(
let (functions, events) = from_any_extractable_to_functions_events(events.to_vec());

let parser = TransactionParser::builder()
.function_in_list(&functions, false)
.functions_out_list(&functions, false)
.events_list(&events)
.function_in_list(functions.clone(), false)
.functions_out_list(functions, false)
.events_list(events)
.build()
.unwrap();

Expand Down

0 comments on commit a41ff3b

Please sign in to comment.