Skip to main content

Check

Trait Check 

Source
pub trait Check: Send + Sync {
    // Required methods
    fn kind(&self) -> &'static str;
    fn stages(&self) -> StageSet;

    // Provided methods
    fn check_connection<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _context: &'life1 ConnectionContext<'life2>,
    ) -> Pin<Box<dyn Future<Output = Verdict> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn check_identifiers<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _context: &'life1 IdentifierContext<'life2>,
    ) -> Pin<Box<dyn Future<Output = Verdict> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
}
Expand description

One named question a policy can ask about a request.

Both hooks default to Verdict::Pass so an implementation writes only the one it serves — but Check::stages has no default, because a check that claims a stage it cannot decide at would silently pass there, which is exactly the failure the stage intersection exists to prevent.

Required Methods§

Source

fn kind(&self) -> &'static str

The check type (allowed_ip, ipam, …), not the instance name — the instance name is the policy’s key for it.

Source

fn stages(&self) -> StageSet

Where this instance can decide.

Provided Methods§

Source

fn check_connection<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _context: &'life1 ConnectionContext<'life2>, ) -> Pin<Box<dyn Future<Output = Verdict> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn check_identifiers<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _context: &'life1 IdentifierContext<'life2>, ) -> Pin<Box<dyn Future<Output = Verdict> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§