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:
parent
f22e4755d3
commit
4d5a412395
@ -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![]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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) {
|
||||||
|
@ -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) {
|
||||||
|
@ -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);
|
||||||
|
@ -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) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user