31 lines
579 B
Rust
31 lines
579 B
Rust
pub type Sender = tokio::sync::broadcast::Sender<Message>;
|
|
pub type Receiver = tokio::sync::broadcast::Receiver<Message>;
|
|
|
|
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
|
|
pub struct Link(String);
|
|
|
|
impl <S> From<S> for Link
|
|
where S: Into<String> {
|
|
fn from(value: S) -> Self {
|
|
Self(value.into())
|
|
}
|
|
}
|
|
|
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
|
pub struct Id(usize);
|
|
|
|
impl Id {
|
|
pub const fn new(n: usize) -> Self {
|
|
Self(n)
|
|
}
|
|
}
|
|
|
|
#[derive(Clone, Debug)]
|
|
pub struct Message {
|
|
pub origin: (Id, String),
|
|
pub link: Link,
|
|
pub author: String,
|
|
pub content: String,
|
|
}
|
|
|