pub enum TokenSourceError {
Unavailable(Arc<dyn Error + Sync + Send>),
Rejected(Arc<dyn Error + Sync + Send>),
Broken(Arc<dyn Error + Sync + Send>),
}Expand description
Why a token source could not provide a token.
A source knows what it authenticates against, so it is the only place that can tell whether
asking again may work. The variant it picks is how it says so; callers read it back through
TokenSourceError::is_transient instead of interpreting the cause themselves.
Variants§
No token right now, but a later call may produce one, e.g. because the request to the token service did not get through.
Rejected(Arc<dyn Error + Sync + Send>)
The credential the source authenticates with was refused, or the answer it got back cannot be used as a token. Asking again yields the same answer.
Broken(Arc<dyn Error + Sync + Send>)
The source itself stopped working, e.g. the task that refreshes its token is gone, so it will not produce a token again.
Implementations§
Source§impl TokenSourceError
impl TokenSourceError
The token could not be obtained now, but a later call may succeed.
Sourcepub fn rejected(
cause: impl Into<Box<dyn Error + Sync + Send>>,
) -> TokenSourceError
pub fn rejected( cause: impl Into<Box<dyn Error + Sync + Send>>, ) -> TokenSourceError
The token cannot be obtained, no matter how often it is asked for.
Sourcepub fn broken(
cause: impl Into<Box<dyn Error + Sync + Send>>,
) -> TokenSourceError
pub fn broken( cause: impl Into<Box<dyn Error + Sync + Send>>, ) -> TokenSourceError
The source can no longer hand out tokens at all.
Sourcepub fn is_transient(&self) -> bool
pub fn is_transient(&self) -> bool
Returns whether the failure is transient, so that a retry may help.
Prefer this over matching the variants: a new variant would silently fall into a caller’s wildcard arm.
Trait Implementations§
Source§impl Clone for TokenSourceError
impl Clone for TokenSourceError
Source§fn clone(&self) -> TokenSourceError
fn clone(&self) -> TokenSourceError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TokenSourceError
impl Debug for TokenSourceError
Source§impl Display for TokenSourceError
impl Display for TokenSourceError
Source§impl Error for TokenSourceError
impl Error for TokenSourceError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<TokenSourceError> for CrpcClientError
impl From<TokenSourceError> for CrpcClientError
Source§fn from(source: TokenSourceError) -> CrpcClientError
fn from(source: TokenSourceError) -> CrpcClientError
Auto Trait Implementations§
impl !RefUnwindSafe for TokenSourceError
impl !UnwindSafe for TokenSourceError
impl Freeze for TokenSourceError
impl Send for TokenSourceError
impl Sync for TokenSourceError
impl Unpin for TokenSourceError
impl UnsafeUnpin for TokenSourceError
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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> ⓘ
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request