pub struct TokenContext {
pub app: Option<String>,
pub permissions: Option<Vec<TokenPermission>>,
pub timestamp: u128,
}
Fields§
§app: Option<String>
§permissions: Option<Vec<TokenPermission>>
§timestamp: u128
Implementations§
source§impl TokenContext
impl TokenContext
sourcepub fn app_name(&self) -> String
pub fn app_name(&self) -> String
Get the value of the token’s app
field
Returns an empty string if the field value is None
sourcepub fn can_do(&self, permission: TokenPermission) -> bool
pub fn can_do(&self, permission: TokenPermission) -> bool
Check if the token has the given TokenPermission
§Returns true
if the field value is None
Trait Implementations§
source§impl Clone for TokenContext
impl Clone for TokenContext
source§fn clone(&self) -> TokenContext
fn clone(&self) -> TokenContext
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for TokenContext
impl Debug for TokenContext
source§impl Default for TokenContext
impl Default for TokenContext
source§impl<'de> Deserialize<'de> for TokenContext
impl<'de> Deserialize<'de> for TokenContext
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TokenContext
impl RefUnwindSafe for TokenContext
impl Send for TokenContext
impl Sync for TokenContext
impl Unpin for TokenContext
impl UnwindSafe for TokenContext
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more