Crates.io | vk-token-manager |
lib.rs | vk-token-manager |
version | 0.2.0 |
source | src |
created_at | 2020-05-11 12:51:14.028329 |
updated_at | 2020-05-15 13:26:42.520503 |
description | Useful abstractions for managing VK tokens |
homepage | |
repository | |
max_upload_size | |
id | 240108 |
size | 7,062 |
This crate provides useful abstractions for managing VK tokens.
[dependencies]
vk-token-manager = "0.2.0"
Checkout /examples
directory for more examples.
use token_manager::{TokenManager, ManageTokens};
use token_manager::{GroupId, SimpleToken, Token};
let mut manager = TokenManager::new(); // create token manager
// put (boxed) token into.
manager.add_token(GroupId::new(123), Box::new(SimpleToken::new(Token::new("my-token".into()))));
let result = async {
// get token by id
let tok = manager.get_by_id(GroupId::new(123)).await;
assert_eq!(tok, Some(&Token::new("my-token".into())));
};