Add entry method to SignatureMap.

This commit is contained in:
Jimmy Cuadra 2019-07-09 02:49:43 -07:00
parent 49f3208e7f
commit fb222b8e82

View File

@ -1,7 +1,7 @@
//! Digital signatures and collections of signatures.
use std::{
collections::{HashMap, HashSet},
collections::{hash_map::Entry, HashMap, HashSet},
error::Error as _,
fmt::{Formatter, Result as FmtResult},
};
@ -136,6 +136,13 @@ impl SignatureMap {
Ok(self.map.insert(host, signature_set))
}
/// Gets the given server's corresponding signature set for in-place manipulation.
pub fn entry(&mut self, server_name: &str) -> Result<Entry<Host, SignatureSet>, Error> {
let host = server_name_to_host(server_name)?;
Ok(self.map.entry(host))
}
/// Gets a reference to the signature set for the given server, if any.
///
/// # Parameters