Skip to content

Commit 9ddaedf

Browse files
committed
varint: implement std::hash::Hash for CqlVarint
1 parent 65146eb commit 9ddaedf

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

scylla-cql/src/frame/value.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,13 @@ impl PartialEq for CqlVarint {
337337
}
338338
}
339339

340+
/// Computes the hash of normalized [`CqlVarint`].
341+
impl std::hash::Hash for CqlVarint {
342+
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
343+
self.as_normalized_slice().hash(state)
344+
}
345+
}
346+
340347
/// Native CQL date representation that allows for a bigger range of dates (-262145-1-1 to 262143-12-31).
341348
///
342349
/// Represented as number of days since -5877641-06-23 i.e. 2^31 days before unix epoch.

0 commit comments

Comments
 (0)