identifiers: Add get method to Signatures
This commit is contained in:
parent
9d34524442
commit
46cf197927
@ -1,4 +1,4 @@
|
|||||||
use std::collections::BTreeMap;
|
use std::{borrow::Borrow, collections::BTreeMap};
|
||||||
|
|
||||||
use crate::{DeviceIdBox, KeyNameBox, ServerNameBox, SigningKeyId, UserId};
|
use crate::{DeviceIdBox, KeyNameBox, ServerNameBox, SigningKeyId, UserId};
|
||||||
|
|
||||||
@ -35,6 +35,15 @@ impl<E: Ord, K: ?Sized> Signatures<E, K> {
|
|||||||
) -> Option<String> {
|
) -> Option<String> {
|
||||||
self.0.entry(entity).or_insert_with(Default::default).insert(key_identifier, value)
|
self.0.entry(entity).or_insert_with(Default::default).insert(key_identifier, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns a reference to the signatures corresponding to the entities.
|
||||||
|
pub fn get<Q>(&self, entity: &Q) -> Option<&EntitySignatures<K>>
|
||||||
|
where
|
||||||
|
E: Borrow<Q>,
|
||||||
|
Q: Ord + ?Sized,
|
||||||
|
{
|
||||||
|
self.0.get(entity)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Map of server signatures for an event, grouped by server.
|
/// Map of server signatures for an event, grouped by server.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user