Trait ConcurrentTracker
pub trait ConcurrentTracker:
Send
+ Sync
+ 'static {
type Guard: Send + 'static;
type Error: Send + 'static;
// Required method
fn try_access(&self) -> Result<Self::Guard, Self::Error>;
}Expand description
The tracker trait that can be implemented to provide custom concurrent input tracking.
By default ConcurrentCounter is provided, but in case you need multi-instance tracking,
you can support that by implementing the ConcurrentTracker trait.
Required Associated Types§
Required Methods§
fn try_access(&self) -> Result<Self::Guard, Self::Error>
fn try_access(&self) -> Result<Self::Guard, Self::Error>
Try to access the resource, returning a guard if successful, or an error if the limit is reached.
When the limit is reached and a backoff is used in the parent structure, the backoff should tried to be used before returning the error.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".