#[cfg(test)]
mod tests;
pub struct BusEvent<ContentType, TopicId> {
id: usize,
topic_id: Option<TopicId>,
source_id: u64,
content: ContentType,
}
impl<ContentType, TopicId> BusEvent<ContentType, TopicId> {
pub fn new(id: usize, source_id: u64, topic_id: Option<TopicId>, content: ContentType) -> Self {
BusEvent {
id,
topic_id,
source_id,
content,
}
}
pub fn get_topic_id(&self) -> &Option<TopicId> {
&self.topic_id
}
pub fn get_id(&self) -> usize {
self.id
}
pub fn get_source_id(&self) -> u64 {
self.source_id
}
pub fn get_content(&self) -> &ContentType {
&self.content
}
pub fn get_mut_content(&mut self) -> &mut ContentType {
&mut self.content
}
}