diff options
Diffstat (limited to 'src/messages/mod.rs')
| -rw-r--r-- | src/messages/mod.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/messages/mod.rs b/src/messages/mod.rs new file mode 100644 index 0000000..ca74078 --- /dev/null +++ b/src/messages/mod.rs @@ -0,0 +1,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> { + 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, + } + } +} |
