keymgr: Add a type alias for `Box<dyn Keystore>`.

This makes the code slightly less verbose.
This commit is contained in:
Gabriela Moldovan 2023-07-18 14:15:19 +01:00
parent ac93b1aef6
commit 8e49d1dd11
No known key found for this signature in database
GPG Key ID: 3946E0ADE72BAC99
1 changed files with 5 additions and 2 deletions

View File

@ -7,18 +7,21 @@ use crate::{EncodableKey, KeySpecifier, Keystore, Result, ToEncodableKey};
use tor_error::internal;
/// A boxed [`Keystore`].
type BoxedKeystore = Box<dyn Keystore>;
/// A key manager with several [`Keystore`]s.
///
/// Note: [`KeyMgr`] is a low-level utility and does not implement caching (the key stores are
/// accessed for every read/write).
pub struct KeyMgr {
/// The underlying persistent stores.
key_stores: Vec<Box<dyn Keystore>>,
key_stores: Vec<BoxedKeystore>,
}
impl KeyMgr {
/// Create a new [`KeyMgr`].
pub fn new(key_stores: Vec<Box<dyn Keystore>>) -> Self {
pub fn new(key_stores: Vec<BoxedKeystore>) -> Self {
Self { key_stores }
}