Struct mas_oidc_client::jose::claims::Claim
source · pub struct Claim<T, V = ()> { /* private fields */ }
Implementations§
source§impl<T, V> Claim<T, V>where
V: Validator<T>,
impl<T, V> Claim<T, V>where
V: Validator<T>,
pub const fn new(claim: &'static str) -> Claim<T, V>
sourcepub fn insert<I>(
&self,
claims: &mut HashMap<String, Value>,
value: I,
) -> Result<(), ClaimError>
pub fn insert<I>( &self, claims: &mut HashMap<String, Value>, value: I, ) -> Result<(), ClaimError>
Insert a claim into the given claims map.
§Errors
Returns an error if the value failed to serialize.
sourcepub fn extract_required(
&self,
claims: &mut HashMap<String, Value>,
) -> Result<T, ClaimError>
pub fn extract_required( &self, claims: &mut HashMap<String, Value>, ) -> Result<T, ClaimError>
Extract a claim from the given claims map.
§Errors
Returns an error if the value failed to deserialize, if its value is invalid or if the claim is missing.
sourcepub fn extract_required_with_options<I>(
&self,
claims: &mut HashMap<String, Value>,
validator: I,
) -> Result<T, ClaimError>
pub fn extract_required_with_options<I>( &self, claims: &mut HashMap<String, Value>, validator: I, ) -> Result<T, ClaimError>
Extract a claim from the given claims map, with the given options.
§Errors
Returns an error if the value failed to deserialize, if its value is invalid or if the claim is missing.
sourcepub fn extract_optional(
&self,
claims: &mut HashMap<String, Value>,
) -> Result<Option<T>, ClaimError>
pub fn extract_optional( &self, claims: &mut HashMap<String, Value>, ) -> Result<Option<T>, ClaimError>
Extract a claim from the given claims map, if it exists.
§Errors
Returns an error if the value failed to deserialize or if its value is invalid.
sourcepub fn extract_optional_with_options<I>(
&self,
claims: &mut HashMap<String, Value>,
validator: I,
) -> Result<Option<T>, ClaimError>
pub fn extract_optional_with_options<I>( &self, claims: &mut HashMap<String, Value>, validator: I, ) -> Result<Option<T>, ClaimError>
Extract a claim from the given claims map, if it exists, with the given options.
§Errors
Returns an error if the value failed to deserialize or if its value is invalid.
Auto Trait Implementations§
impl<T, V> Freeze for Claim<T, V>
impl<T, V> RefUnwindSafe for Claim<T, V>where
T: RefUnwindSafe,
V: RefUnwindSafe,
impl<T, V> Send for Claim<T, V>
impl<T, V> Sync for Claim<T, V>
impl<T, V> Unpin for Claim<T, V>
impl<T, V> UnwindSafe for Claim<T, V>where
T: UnwindSafe,
V: UnwindSafe,
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> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§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