Skip to main content

ExecutionGuard

Trait ExecutionGuard 

Source
pub trait ExecutionGuard {
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn acquire(
        &self,
        slot: ExecutionSlot,
    ) -> impl Future<Output = Result<ExecutionGuardAcquire, Self::Error>> + Send;
    fn renew(
        &self,
        lease: &ExecutionLease,
    ) -> impl Future<Output = Result<ExecutionGuardRenewal, Self::Error>> + Send;
    fn release(
        &self,
        lease: &ExecutionLease,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;

    // Provided methods
    fn classify_error(_error: &Self::Error) -> ExecutionGuardErrorKind
       where Self: Sized { ... }
    fn renew_interval(&self, _lease: &ExecutionLease) -> Option<Duration> { ... }
}

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

Required Methods§

Source

fn acquire( &self, slot: ExecutionSlot, ) -> impl Future<Output = Result<ExecutionGuardAcquire, Self::Error>> + Send

Source

fn renew( &self, lease: &ExecutionLease, ) -> impl Future<Output = Result<ExecutionGuardRenewal, Self::Error>> + Send

Source

fn release( &self, lease: &ExecutionLease, ) -> impl Future<Output = Result<(), Self::Error>> + Send

Provided Methods§

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T> ExecutionGuard for Arc<T>
where T: ExecutionGuard + Send + Sync,

Source§

type Error = <T as ExecutionGuard>::Error

Source§

async fn acquire( &self, slot: ExecutionSlot, ) -> Result<ExecutionGuardAcquire, Self::Error>

Source§

async fn renew( &self, lease: &ExecutionLease, ) -> Result<ExecutionGuardRenewal, Self::Error>

Source§

async fn release(&self, lease: &ExecutionLease) -> Result<(), Self::Error>

Source§

fn classify_error(error: &Self::Error) -> ExecutionGuardErrorKind
where Self: Sized,

Source§

fn renew_interval(&self, lease: &ExecutionLease) -> Option<Duration>

Implementors§