lavina/crates/projection-irc/src/handler.rs

21 lines
589 B
Rust

use std::future::Future;
use anyhow::Result;
use tokio::io::AsyncWrite;
use lavina_core::player::PlayerConnection;
use lavina_core::prelude::Str;
pub struct IrcConnection<'a, T: AsyncWrite + Unpin> {
pub server_name: Str,
/// client is nick of requester
pub client: Str,
pub writer: &'a mut T,
pub player_connection: &'a mut PlayerConnection,
}
/// Represents a client-to-server IRC message that can be handled by the server.
pub trait IrcCommand {
fn handle_with(&self, conn: &mut IrcConnection<impl AsyncWrite + Unpin>) -> impl Future<Output = Result<()>>;
}