Skip to content

Commit 6588932

Browse files
committed
fix: hasheable user agent
1 parent be9d7b2 commit 6588932

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

relay_rpc/src/user_agent.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub enum ParsingError {
3737
///
3838
/// [`UserAgent`] will only fail to parse an empty string. Otherwise the result
3939
/// will be either a [`ValidUserAgent`] or an unknown user agent string.
40-
#[derive(Debug, Clone, Eq, PartialEq)]
40+
#[derive(Debug, Clone, Hash, Eq, PartialEq)]
4141
pub enum UserAgent {
4242
Unknown(String),
4343
ValidUserAgent(ValidUserAgent),
@@ -46,34 +46,34 @@ pub enum UserAgent {
4646
/// Represents a valid (parsed) user agent.
4747
///
4848
/// Succeeds in parsing only if all of its parts are successfully parsed.
49-
#[derive(Debug, Clone, Eq, PartialEq)]
49+
#[derive(Debug, Clone, Hash, Eq, PartialEq)]
5050
pub struct ValidUserAgent {
5151
pub protocol: Protocol,
5252
pub sdk: Sdk,
5353
pub os: OsInfo,
5454
pub id: Option<Id>,
5555
}
5656

57-
#[derive(Debug, Clone, Eq, PartialEq)]
57+
#[derive(Debug, Clone, Hash, Eq, PartialEq)]
5858
pub struct OsInfo {
5959
pub os_family: String,
6060
pub ua_family: Option<String>,
6161
pub version: Option<String>,
6262
}
6363

64-
#[derive(Debug, Clone, Eq, PartialEq)]
64+
#[derive(Debug, Clone, Hash, Eq, PartialEq)]
6565
pub enum ProtocolKind {
6666
WalletConnect,
6767
Unknown(String),
6868
}
6969

70-
#[derive(Debug, Clone, Eq, PartialEq)]
70+
#[derive(Debug, Clone, Hash, Eq, PartialEq)]
7171
pub struct Protocol {
7272
pub kind: ProtocolKind,
7373
pub version: u32,
7474
}
7575

76-
#[derive(Debug, Clone, Eq, PartialEq)]
76+
#[derive(Debug, Clone, Hash, Eq, PartialEq)]
7777
pub enum SdkLanguage {
7878
Js,
7979
Swift,
@@ -83,13 +83,13 @@ pub enum SdkLanguage {
8383
Unknown(String),
8484
}
8585

86-
#[derive(Debug, Clone, Eq, PartialEq)]
86+
#[derive(Debug, Clone, Hash, Eq, PartialEq)]
8787
pub struct Sdk {
8888
pub language: SdkLanguage,
8989
pub version: String,
9090
}
9191

92-
#[derive(Debug, Clone, Eq, PartialEq)]
92+
#[derive(Debug, Clone, Hash, Eq, PartialEq)]
9393
pub enum Environment {
9494
Browser,
9595
ReactNative,
@@ -99,7 +99,7 @@ pub enum Environment {
9999
Unknown(String),
100100
}
101101

102-
#[derive(Debug, Clone, Eq, PartialEq)]
102+
#[derive(Debug, Clone, Hash, Eq, PartialEq)]
103103
pub struct Id {
104104
pub environment: Environment,
105105
pub host: Option<String>,

0 commit comments

Comments
 (0)