From fb222b8e8203e5786301b1c35dda51dac44ae041 Mon Sep 17 00:00:00 2001 From: Jimmy Cuadra Date: Tue, 9 Jul 2019 02:49:43 -0700 Subject: [PATCH] Add entry method to SignatureMap. --- src/signatures.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/signatures.rs b/src/signatures.rs index efacc138..e3bd1434 100644 --- a/src/signatures.rs +++ b/src/signatures.rs @@ -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, 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