Add Msg and MsgStore traits
This commit is contained in:
parent
84d554dee9
commit
bea4ed90e7
4 changed files with 80 additions and 5 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#![warn(clippy::use_self)]
|
||||
|
||||
mod traits;
|
||||
mod ui;
|
||||
|
||||
use toss::terminal::Terminal;
|
||||
|
|
|
|||
16
cove-tui/src/traits.rs
Normal file
16
cove-tui/src/traits.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
use async_trait::async_trait;
|
||||
use chrono::{DateTime, Utc};
|
||||
|
||||
pub trait Msg {
|
||||
type Id;
|
||||
fn id(&self) -> Self::Id;
|
||||
|
||||
fn time(&self) -> DateTime<Utc>;
|
||||
fn nick(&self) -> String;
|
||||
fn content(&self) -> String;
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
pub trait MsgStore<M: Msg> {
|
||||
async fn path(room: &str, id: M::Id) -> Vec<M::Id>;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue