iota/iota-storage/src/users/contact.rs
Alex Emmet 3be1d9f308 [Mig] storage to SQLite pool
[Clean] split message handler dispatch
2026-07-08 23:40:46 +02:00

35 lines
792 B
Rust

use std::time::{SystemTime, UNIX_EPOCH};
#[derive(Debug, Clone)]
pub struct Contact {
pub user_id: i64,
pub user_name: Option<String>,
pub last_message_at: Option<i64>,
}
impl Default for Contact {
fn default() -> Self {
let now = SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_millis() as i64;
Contact {
user_id: 0,
user_name: None,
last_message_at: Some(now),
}
}
}
impl Contact {
pub fn new(user_id: i64) -> Self {
Contact {
user_id: user_id,
user_name: None,
last_message_at: None,
}
}
pub fn set_last_message_at(&mut self, p0: i64) {
self.last_message_at = Option::from(p0);
}
}