pub struct PeatCredentials { /* private fields */ }Expand description
Peat credentials for backend authentication.
Implementations§
Source§impl PeatCredentials
impl PeatCredentials
Sourcepub fn new(app_id: String, secret_key: Option<String>) -> Self
pub fn new(app_id: String, secret_key: Option<String>) -> Self
Create credentials from explicit values.
Sourcepub fn from_env() -> Result<Self, CredentialsError>
pub fn from_env() -> Result<Self, CredentialsError>
Load credentials from environment variables.
Reads PEAT_APP_ID (required) and PEAT_SECRET_KEY (or
PEAT_SHARED_KEY as an alias, optional).
Sourcepub fn try_from_env() -> Option<Self>
pub fn try_from_env() -> Option<Self>
Load credentials from environment, returning None if not configured.
Sourcepub fn is_configured() -> bool
pub fn is_configured() -> bool
Whether PEAT_APP_ID is configured in the environment.
Sourcepub fn secret_key(&self) -> Option<&str>
pub fn secret_key(&self) -> Option<&str>
Shared secret key, if configured.
Sourcepub fn has_secret_key(&self) -> bool
pub fn has_secret_key(&self) -> bool
Whether a secret key is configured.
Sourcepub fn require_secret_key(&self) -> Result<&str, CredentialsError>
pub fn require_secret_key(&self) -> Result<&str, CredentialsError>
Get the secret key, or return an error if missing.
Trait Implementations§
Source§impl Clone for PeatCredentials
impl Clone for PeatCredentials
Source§fn clone(&self) -> PeatCredentials
fn clone(&self) -> PeatCredentials
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 moreAuto Trait Implementations§
impl Freeze for PeatCredentials
impl RefUnwindSafe for PeatCredentials
impl Send for PeatCredentials
impl Sync for PeatCredentials
impl Unpin for PeatCredentials
impl UnsafeUnpin for PeatCredentials
impl UnwindSafe for PeatCredentials
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