events: Derive Hash for ReceiptType and ReceiptThread
Since uniqueness of receipts is determined per type and per thread it's common to use them as keys of a map.
This commit is contained in:
parent
db6acae8a8
commit
ad86f4603a
@ -1,5 +1,9 @@
|
||||
# [unreleased]
|
||||
|
||||
Improvements:
|
||||
|
||||
- Derive `Hash` for `ReceiptType` and `ReceiptThread`
|
||||
|
||||
# 0.11.1
|
||||
|
||||
Improvements:
|
||||
|
@ -59,7 +59,7 @@ pub type Receipts = BTreeMap<ReceiptType, UserReceipts>;
|
||||
|
||||
/// The type of receipt.
|
||||
#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))]
|
||||
#[derive(Clone, PartialOrdAsRefStr, OrdAsRefStr, PartialEqAsRefStr, Eq, StringEnum)]
|
||||
#[derive(Clone, PartialOrdAsRefStr, OrdAsRefStr, PartialEqAsRefStr, Eq, StringEnum, Hash)]
|
||||
#[non_exhaustive]
|
||||
pub enum ReceiptType {
|
||||
/// A [public read receipt].
|
||||
@ -132,7 +132,7 @@ impl Receipt {
|
||||
/// representation, obtained through [`.as_str()`](Self::as_str()).
|
||||
///
|
||||
/// [thread a receipt applies to]: https://spec.matrix.org/v1.4/client-server-api/#threaded-read-receipts
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
|
||||
#[non_exhaustive]
|
||||
pub enum ReceiptThread {
|
||||
/// The receipt applies to the timeline, regardless of threads.
|
||||
|
Loading…
x
Reference in New Issue
Block a user