Skip to main content

MemoryTokenStore

Struct MemoryTokenStore 

Source
pub struct MemoryTokenStore { /* private fields */ }
Expand description

Tokens held in this process’s memory.

Everything is lost on restart and nothing is shared between processes, which makes it right for tests and for cargo run, and wrong for a deployment where a token issued by one worker must be accepted by another.

Implementations§

Source§

impl MemoryTokenStore

Source

pub fn new() -> Self

Source

pub fn len(&self) -> usize

How many tokens are held. For tests.

Source

pub fn is_empty(&self) -> bool

Trait Implementations§

Source§

impl Debug for MemoryTokenStore

A count, and nothing else.

Printing the tokens themselves would put thirty-two digests into whatever log line printed the store.

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MemoryTokenStore

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl TokenStore for MemoryTokenStore

Source§

fn create(&self, token: Token) -> TokenFuture<'_, Token>

Persist a newly issued token and return it as stored. Read more
Source§

fn find<'a>(&'a self, id: &'a str) -> TokenFuture<'a, Option<Token>>

Load one token by id, or None when there is no such row. Read more
Source§

fn delete<'a>(&'a self, id: &'a str) -> TokenFuture<'a, ()>

Revoke one token. Deleting an id that is already gone is not an error.
Source§

fn delete_for_identity<'a>( &'a self, identity: &'a Identity, ) -> TokenFuture<'a, ()>

Revoke every token belonging to one user. Read more
Source§

fn touch<'a>(&'a self, id: &'a str, at: u64) -> TokenFuture<'a, ()>

Stamp last_used_at, in unix seconds. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.