Julio Biason
3 years ago
3 changed files with 30 additions and 0 deletions
@ -0,0 +1,10 @@
|
||||
[package] |
||||
name = "shared" |
||||
version = "0.1.0" |
||||
edition = "2021" |
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html |
||||
|
||||
[dependencies] |
||||
chrono = { version = "0.4.19", features = ["serde"] } |
||||
serde = { version = "1.0.130", features = ["derive"] } |
@ -0,0 +1,19 @@
|
||||
use chrono::offset::Utc; |
||||
use chrono::DateTime; |
||||
use serde::Deserialize; |
||||
use serde::Serialize; |
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)] |
||||
pub struct Message { |
||||
received: DateTime<Utc>, |
||||
message: String, |
||||
} |
||||
|
||||
impl Message { |
||||
pub fn new(message: &str) -> Self { |
||||
Self { |
||||
received: Utc::now(), |
||||
message: message.into(), |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue