pub enum TokenResult {
Pass,
Blocked(BlockError),
Wait(u64),
}
Variants§
Implementations§
Source§impl TokenResult
impl TokenResult
pub fn new_pass() -> Self
pub fn new_should_wait(nanos_to_wait: u64) -> Self
pub fn new_blocked(block_type: BlockType) -> Self
pub fn new_blocked_with_msg(block_type: BlockType, block_msg: String) -> Self
pub fn new_blocked_with_cause( block_type: BlockType, block_msg: String, rule: Arc<dyn SentinelRule>, snapshot_value: Arc<Snapshot>, ) -> Self
pub fn reset_to_pass(&mut self)
pub fn reset_to_blocked(&mut self, block_type: BlockType)
pub fn reset_to_blocked_with_msg( &mut self, block_type: BlockType, block_msg: String, )
pub fn reset_to_blocked_with_cause( &mut self, block_type: BlockType, block_msg: String, rule: Arc<dyn SentinelRule>, snapshot_value: Arc<Snapshot>, )
pub fn is_pass(&self) -> bool
pub fn is_blocked(&self) -> bool
pub fn is_wait(&self) -> bool
pub fn block_err(&self) -> Option<BlockError>
pub fn nanos_to_wait(&self) -> u64
Trait Implementations§
Source§impl Clone for TokenResult
impl Clone for TokenResult
Source§fn clone(&self) -> TokenResult
fn clone(&self) -> TokenResult
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for TokenResult
impl Debug for TokenResult
Source§impl Default for TokenResult
impl Default for TokenResult
Source§impl Display for TokenResult
impl Display for TokenResult
Source§impl PartialEq for TokenResult
impl PartialEq for TokenResult
impl StructuralPartialEq for TokenResult
Auto Trait Implementations§
impl Freeze for TokenResult
impl !RefUnwindSafe for TokenResult
impl Send for TokenResult
impl Sync for TokenResult
impl Unpin for TokenResult
impl !UnwindSafe for TokenResult
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 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>
Wrap the input message
T
in a tonic::Request