pub struct ApiKey { /* private fields */ }Implementations§
Source§impl ApiKey
impl ApiKey
pub fn empty() -> Self
Sourcepub fn from_toml(value: &str) -> Self
pub fn from_toml(value: &str) -> Self
Parse a value from the TOML config file.
Recognises $hmac-sha256$... as a pre-hashed key, otherwise stores as plaintext.
Sourcepub fn from_env(value: &str) -> Self
pub fn from_env(value: &str) -> Self
Value comes from an environment variable — will never be written back to TOML.
pub fn is_empty(&self) -> bool
Sourcepub fn verify(&self, provided: &str) -> bool
pub fn verify(&self, provided: &str) -> bool
Timing-safe verification of a provided plaintext key.
Sourcepub fn to_toml_value(&self) -> String
pub fn to_toml_value(&self) -> String
Value to persist in TOML. Returns "" for env-var sourced keys.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ApiKey
impl RefUnwindSafe for ApiKey
impl Send for ApiKey
impl Sync for ApiKey
impl Unpin for ApiKey
impl UnsafeUnpin for ApiKey
impl UnwindSafe for ApiKey
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,
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