Skip to main content

StandingRuleSource

Trait StandingRuleSource 

Source
pub trait StandingRuleSource: Send + Sync {
    // Required method
    fn rules<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        app: &'life1 str,
        user: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<RuleAge>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Reads the standing rules the review checks (spec 3.2 §9.1): the harness implements it over its rule store and Harness::kernel registers it (KernelBuilder::standing_rules).

§Example

use adk_kernel::{RuleAge, StandingRuleSource};
use async_trait::async_trait;

struct Fixed(Vec<RuleAge>);

#[async_trait]
impl StandingRuleSource for Fixed {
    async fn rules(&self, _app: &str, user: &str) -> adk_kernel::Result<Vec<RuleAge>> {
        Ok(self.0.iter().filter(|rule| rule.user == user).cloned().collect())
    }
}

Required Methods§

Source

fn rules<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, app: &'life1 str, user: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<RuleAge>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Every standing rule of user in app.

§Errors

Returns the rule store’s error; the review then lists no rules.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§