Add Msg and MsgStore traits
This commit is contained in:
parent
84d554dee9
commit
bea4ed90e7
4 changed files with 80 additions and 5 deletions
|
|
@ -5,6 +5,8 @@ edition = "2021"
|
|||
|
||||
[dependencies]
|
||||
anyhow = "1.0.57"
|
||||
async-trait = "0.1.56"
|
||||
chrono = "0.4.19"
|
||||
clap = { version = "3.1.18", features = ["derive"] }
|
||||
crossterm = { version = "0.23.2", features = ["event-stream"] }
|
||||
futures = "0.3.21"
|
||||
|
|
|
|||
|
|
@ -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