Newer
Older
ExoLauncher / src-tauri / src / dispatcher.rs
@楽曲作りまくりおじさん 楽曲作りまくりおじさん 10 hours ago 740 bytes Initial commit: ExoLauncher Desktop App with SSE and cleaned structure
#![allow(dead_code)]
use async_trait::async_trait;
use crate::models::QueuedOutput;
use anyhow::Result;

#[async_trait]
pub trait Dispatcher: Send + Sync {
    async fn dispatch(&self, output: &QueuedOutput) -> Result<()>;
    fn target_name(&self) -> &str;
}

pub struct ConsoleDispatcher;

#[async_trait]
impl Dispatcher for ConsoleDispatcher {
    async fn dispatch(&self, output: &QueuedOutput) -> Result<()> {
        println!("--- Console Dispatch ---");
        println!("Target: {}", output.target);
        println!("Content: {}", output.content);
        println!("Metadata: {:?}", output.metadata);
        println!("------------------------");
        Ok(())
    }

    fn target_name(&self) -> &str {
        "console"
    }
}