22 lines
389 B
Rust
22 lines
389 B
Rust
#[derive(Debug, Clone)]
|
|
pub enum Message {
|
|
Command(MessageBody),
|
|
QueueStop,
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct MessageBody {
|
|
id: u32,
|
|
content: String,
|
|
}
|
|
|
|
impl Message {
|
|
pub fn command(id: u32, content: &str) -> Message {
|
|
let body = MessageBody {
|
|
id: id,
|
|
content: content.to_string(),
|
|
};
|
|
Message::Command(body)
|
|
}
|
|
}
|