we're sending Envelope and transmitting Arc<Envelope>, since we're wrapping the Envelope in an Arc to transmit it, we (probably) don't need to wrap the Event in an Arc too

This commit is contained in:
Adrian Malacoda 2017-02-25 20:33:47 -06:00
parent f22e4755d3
commit 4d5a412395
5 changed files with 6 additions and 6 deletions

View File

@ -14,7 +14,7 @@ pub enum Event {
pub struct Envelope { pub struct Envelope {
pub from: Option<String>, pub from: Option<String>,
pub event: Arc<Event>, pub event: Event,
pub to: Vec<String> pub to: Vec<String>
} }
@ -22,7 +22,7 @@ impl Envelope {
pub fn new (event: Event) -> Envelope { pub fn new (event: Event) -> Envelope {
Envelope { Envelope {
from: None, from: None,
event: Arc::new(event), event: event,
to: vec![] to: vec![]
} }
} }

View File

@ -28,7 +28,7 @@ impl Module for EchoModule {
loop { loop {
match receiver.recv() { match receiver.recv() {
Ok(envelope) => { Ok(envelope) => {
match *envelope.event { match envelope.event {
Event::Message { ref message } => { Event::Message { ref message } => {
debug!("Received message... {:?}", message.content); debug!("Received message... {:?}", message.content);
match split_command(&message.content) { match split_command(&message.content) {

View File

@ -37,7 +37,7 @@ impl Module for EchoboxModule {
loop { loop {
match receiver.recv() { match receiver.recv() {
Ok(envelope) => { Ok(envelope) => {
match *envelope.event { match envelope.event {
Event::Message { ref message } => { Event::Message { ref message } => {
debug!("Received message... {:?}", message.content); debug!("Received message... {:?}", message.content);
match split_command(&message.content) { match split_command(&message.content) {

View File

@ -144,7 +144,7 @@ impl Module for PvnModule {
loop { loop {
match receiver.recv() { match receiver.recv() {
Ok(envelope) => { Ok(envelope) => {
match *envelope.event { match envelope.event {
Event::Message { ref message } => { Event::Message { ref message } => {
let command = split_command(&message.content); let command = split_command(&message.content);
debug!("Received message... {:?}", &message.content); debug!("Received message... {:?}", &message.content);

View File

@ -41,7 +41,7 @@ impl Module for RandomModule {
loop { loop {
match receiver.recv() { match receiver.recv() {
Ok(envelope) => { Ok(envelope) => {
match *envelope.event { match envelope.event {
Event::Message { ref message } => { Event::Message { ref message } => {
debug!("Received message... {:?}", message.content); debug!("Received message... {:?}", message.content);
match split_command(&message.content) { match split_command(&message.content) {