pub trait ObservationPhraser: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn phrase<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
detection: &'life1 Detection,
budget: &'life2 RunBudget,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}Expand description
Words a detection as a question (spec 3.2 §7.10): a model, used only after the
deterministic detection found something. The kernel keeps a reply only when it is a
neutral question (is_neutral_question) and uses its template otherwise.
§Example
use adk_core::RunBudget;
use adk_kernel::proc::baselines::{Detection, ObservationPhraser};
use async_trait::async_trait;
struct Template;
#[async_trait]
impl ObservationPhraser for Template {
fn name(&self) -> &str {
"template"
}
async fn phrase(&self, detection: &Detection, _budget: &RunBudget) -> adk_kernel::Result<String> {
Ok(detection.template())
}
}Required Methods§
Sourcefn name(&self) -> &str
fn name(&self) -> &str
The model’s name, recorded as the observation’s Phrasing::Model.
Sourcefn phrase<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
detection: &'life1 Detection,
budget: &'life2 RunBudget,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn phrase<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
detection: &'life1 Detection,
budget: &'life2 RunBudget,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
The question for detection, within budget.
§Errors
Returns the model’s error; the kernel then words the observation itself.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".