mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-26 09:38:11 +08:00
Dispatcher::handle_message does not need Result anymore (#365)
* Dispatcher::handle_message does not need Result anymore (1) Callers can get rid of result handling, too. * Dispatcher::handle_message does not need Result anymore (2) * Dispatcher::handle_message does not need Result anymore (3) cargo fmt
This commit is contained in:
+5
-6
@@ -39,12 +39,11 @@ impl Editor {
|
||||
Self { dispatcher: Dispatcher::new() }
|
||||
}
|
||||
|
||||
pub fn handle_message<T: Into<Message>>(&mut self, message: T) -> Result<Vec<FrontendMessage>, EditorError> {
|
||||
self.dispatcher.handle_message(message).map(|_| {
|
||||
let mut responses = Vec::new();
|
||||
std::mem::swap(&mut responses, &mut self.dispatcher.responses);
|
||||
responses
|
||||
})
|
||||
pub fn handle_message<T: Into<Message>>(&mut self, message: T) -> Vec<FrontendMessage> {
|
||||
self.dispatcher.handle_message(message);
|
||||
let mut responses = Vec::new();
|
||||
std::mem::swap(&mut responses, &mut self.dispatcher.responses);
|
||||
responses
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user