blob: ef326a08db9dd516c1b9096be39d86afd2bbf927 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
use std::marker::Sized;
pub mod callback;
pub mod not_understood;
pub use self::callback::Callback;
pub use self::not_understood::NotUnderstood;
#[derive(Serialize)]
pub struct OutgoingMsg<T: Message> {
pub result_type: String,
pub content: T,
}
pub trait Message {
fn name(&self) -> String;
fn as_outgoing(self) -> OutgoingMsg<Self>
where
Self: Sized,
{
OutgoingMsg {
result_type: self.name(),
content: self,
}
}
}
|