vc_processors/core/
mod.rs

1//! This module provides the most important types and abstractions
2//!
3
4use std::fmt::Debug;
5
6use anyhow::Result;
7use serde::{de::DeserializeOwned, Serialize};
8
9pub mod ext;
10
11/// Task of a specific stage, with Output & Error defined
12pub trait Task
13where
14    Self: Serialize + DeserializeOwned + Debug + Send + Sync + 'static,
15    Self::Output: Serialize + DeserializeOwned + Debug + Send + Sync + 'static,
16{
17    /// The stage name.
18    const STAGE: &'static str;
19
20    /// The output type
21    type Output;
22}
23
24/// Processor of a specific task type
25pub trait Processor<T: Task>
26where
27    Self: Send + Sync,
28{
29    /// Process the given task.
30    fn process(&self, task: T) -> Result<<T as Task>::Output>;
31}