imp(Storage): Implement Default for MemoryStorage and make errors sendable

This commit is contained in:
Lewin Bormann
2019-06-13 15:30:50 +02:00
parent a656df6b74
commit 18411a0610

View File

@@ -20,7 +20,7 @@ use crate::types::Token;
/// For completeness, the underlying, sorted scopes are provided as well. They might be
/// useful for presentation to the user.
pub trait TokenStorage {
type Error: 'static + Error;
type Error: 'static + Error + Send;
/// If `token` is None, it is invalid or revoked and should be removed from storage.
/// Otherwise, it should be saved.
@@ -85,6 +85,12 @@ pub struct MemoryStorage {
pub tokens: HashMap<u64, Token>,
}
impl MemoryStorage {
pub fn new() -> MemoryStorage {
Default::default()
}
}
impl TokenStorage for MemoryStorage {
type Error = NullError;