pub enum TokenLifetime {
Days1,
Days7,
Days30,
Days90,
Never,
}Expand description
令牌有效期预设:管理员在 UI 上从下拉菜单选择。
序列化形式供前端选择回传(days1 / days7 / days30 / days90 / never)。
Never 对应 expires_at = NULL(长期令牌);其余按当前时间 + N 天计算。
Variants§
Days1
1 天(默认推荐:最小权限、轮换友好)。
Days7
7 天。
Days30
30 天。
Days90
90 天。
Never
永不过期(expires_at = NULL)。仅用于可信长期客户端。
Implementations§
Source§impl TokenLifetime
impl TokenLifetime
Sourcefn expires_at(self) -> Option<DateTime<Utc>>
fn expires_at(self) -> Option<DateTime<Utc>>
计算签发时刻对应的过期时间戳(UTC)。Never 返回 None。
Trait Implementations§
Source§impl Clone for TokenLifetime
impl Clone for TokenLifetime
Source§fn clone(&self) -> TokenLifetime
fn clone(&self) -> TokenLifetime
Returns a duplicate 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 TokenLifetime
impl Debug for TokenLifetime
Source§impl<'de> Deserialize<'de> for TokenLifetime
impl<'de> Deserialize<'de> for TokenLifetime
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
Source§impl PartialEq for TokenLifetime
impl PartialEq for TokenLifetime
Source§impl Serialize for TokenLifetime
impl Serialize for TokenLifetime
impl Copy for TokenLifetime
impl Eq for TokenLifetime
impl StructuralPartialEq for TokenLifetime
Auto Trait Implementations§
impl Freeze for TokenLifetime
impl RefUnwindSafe for TokenLifetime
impl Send for TokenLifetime
impl Sync for TokenLifetime
impl Unpin for TokenLifetime
impl UnsafeUnpin for TokenLifetime
impl UnwindSafe for TokenLifetime
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Create an instance of this type from an initialization function
§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>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.
§impl<T> Transportable for Twhere
T: Serialize + DeserializeOwned + 'static,
impl<T> Transportable for Twhere
T: Serialize + DeserializeOwned + 'static,
§fn transport_to_bytes(&self) -> Vec<u8> ⓘ
fn transport_to_bytes(&self) -> Vec<u8> ⓘ
Serialize the type to a byte vector for transport
§fn transport_from_bytes(bytes: &[u8]) -> Result<T, Error<Error>>
fn transport_from_bytes(bytes: &[u8]) -> Result<T, Error<Error>>
Deserialize the type from a byte slice