can't seem to fix Event ownership issue in run(){ ... loop {match event {} } }

This commit is contained in:
some body 2021-09-17 14:39:56 -05:00
parent e7b30d1753
commit 7a565c3696
3 changed files with 15 additions and 5 deletions

View File

@ -6,7 +6,9 @@ pub enum InternalEvent {
Shutdown,
}
pub enum EventKind {
//TODO maybe make message a trait
Message,
Internal(InternalEvent),
}

View File

@ -39,8 +39,7 @@ impl Endpoint for IrcEndpoint {
sender_name: self.name(),
}).await;
break;
return;
loop {
//TODO impl

View File

@ -106,7 +106,7 @@ impl RircdState {
let event = event.unwrap();
//EVENT MATCHING
match event.kind {
match &event.kind {
//INTERNAL
EventKind::Internal(ev) => {
@ -145,9 +145,18 @@ impl RircdState {
assert!( event.result_sender.send(EventResponse::Success).is_ok());
},
//EXTERNAL
//MESSAGE
EventKind::Message => {
//TODO maybe notify sender if one
//of the endpoints isn't connected
//or just write to log or do nothing depending
//on the chosen configuration
iter(&self.endpoints).all(|ep| async {
if ep.endpoint.name() == event.sender_name {
ep.sender.unwrap().send(event);
}
false
}).await;
},
};
},