1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
use {Hash, Token, Bytes, Result, TopicFilter};
pub trait LogFilter {
fn wildcard_filter(&self) -> TopicFilter;
}
pub trait ParseLog {
type Log;
fn parse_log(&self, log: RawLog) -> Result<Self::Log>;
}
#[derive(Debug, PartialEq, Clone)]
pub struct RawLog {
pub topics: Vec<Hash>,
pub data: Bytes,
}
impl From<(Vec<Hash>, Bytes)> for RawLog {
fn from(raw: (Vec<Hash>, Bytes)) -> Self {
RawLog {
topics: raw.0,
data: raw.1,
}
}
}
#[derive(Debug, PartialEq, Clone)]
pub struct LogParam {
pub name: String,
pub value: Token,
}
#[derive(Debug, PartialEq, Clone)]
pub struct Log {
pub params: Vec<LogParam>,
}