[−][src]Struct jwt_compact::prelude::TimeOptions
Time-related options for token creation and validation.
If the clock
crate feature is on (and it's on by default), TimeOptions
can be created
using the Default
impl or Self::from_leeway()
. If the feature is off,
you can still create options using a generic constructor.
Examples
// Default options. let default_options = TimeOptions::default(); let options_with_custom_leeway = TimeOptions::from_leeway(Duration::seconds(5)); // Options that have a fixed time. Can be useful for testing. let clock_time = Utc::now(); let options_with_stopped_clock = TimeOptions::new(Duration::seconds(10), move || clock_time);
Fields (Non-exhaustive)
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.leeway: Duration
Leeway to use during validation.
clock_fn: F
Source of the current timestamps.
Implementations
impl<F: Fn() -> DateTime<Utc>> TimeOptions<F>
[src]
pub fn new(leeway: Duration, clock_fn: F) -> Self
[src]
Creates options based on the specified time leeway and clock function.
impl TimeOptions
[src]
pub fn from_leeway(leeway: Duration) -> Self
[src]
Creates options based on the specified time leeway. The clock source is Utc::now()
.
Trait Implementations
impl<F: Clone> Clone for TimeOptions<F>
[src]
fn clone(&self) -> TimeOptions<F>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<F: Copy> Copy for TimeOptions<F>
[src]
impl<F: Debug> Debug for TimeOptions<F>
[src]
impl Default for TimeOptions
[src]
Creates options with a default leeway (60 seconds) and the Utc::now()
clock.
This impl is supported on crate feature clock
only.
Auto Trait Implementations
impl<F> RefUnwindSafe for TimeOptions<F> where
F: RefUnwindSafe,
F: RefUnwindSafe,
impl<F> Send for TimeOptions<F> where
F: Send,
F: Send,
impl<F> Sync for TimeOptions<F> where
F: Sync,
F: Sync,
impl<F> Unpin for TimeOptions<F> where
F: Unpin,
F: Unpin,
impl<F> UnwindSafe for TimeOptions<F> where
F: UnwindSafe,
F: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,