commit-bridge 0.1.0

Seamless workflow dispatch for remote git dependencies.
Documentation
//! Interface definitions for async engines.

use async_trait::async_trait;
use tokio_util::task::TaskTracker;

use tracing::info;

/// Defines the interface of an asynchronous background running engine.
#[async_trait]
pub trait AsyncEngine: Send + Sync + 'static {
    /// The core execution loop of the engine.
    async fn run(&self);
}

/// Starts the engine by spawning it in a new task.
pub fn start_engine(engine: Box<dyn AsyncEngine>, message: &str, tracker: &TaskTracker) {
    info!(message);
    tracker.spawn(async move {
        engine.run().await;
    });
}