Rircd/src/endpoint.rs

15 lines
368 B
Rust
Raw Normal View History

2021-09-16 21:33:48 +02:00
use eyre::Result;
2021-09-16 20:55:05 +02:00
use async_trait::async_trait;
2021-09-16 22:40:40 +02:00
use tokio::sync::{mpsc, oneshot};
2021-09-16 21:33:48 +02:00
use std::sync::Arc;
2021-09-16 22:40:40 +02:00
use crate::event::Event;
2021-09-16 20:55:05 +02:00
#[async_trait]
pub trait Endpoint {
fn name(&self) -> String;
2021-09-16 21:33:48 +02:00
fn is_active(&self) -> bool;
2021-09-16 23:47:52 +02:00
async fn listen(self: Arc<Self>, event_sender: oneshot::Sender<Result<mpsc::Sender<Event>>>,
event_handler: mpsc::Sender<Event>);
2021-09-16 20:55:05 +02:00
}