mirror of
https://github.com/OMGeeky/yup-oauth2.git
synced 2026-01-18 16:34:04 +01:00
imp(Storage): Implement Default for MemoryStorage and make errors sendable
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user