Trait design_pattern_examples_rust::handlerchain::handlerchain_imessagehandler_trait::IMessageHandler
source · pub trait IMessageHandler {
// Required methods
fn id(&self) -> i32;
fn process_message(&mut self, message: &Message) -> MessageReturnTypes;
fn to_string(&self) -> String;
}
Expand description
Represents a handler in a chain of handlers. All objects that participate in the HandlerChain class must implement this trait.
Required Methods§
sourcefn id(&self) -> i32
fn id(&self) -> i32
ID of the window. This is used to uniquely identify a window in the collection.
sourcefn process_message(&mut self, message: &Message) -> MessageReturnTypes
fn process_message(&mut self, message: &Message) -> MessageReturnTypes
Called with a message for the window.
Parameters
-
message
Message object representing the message to process.
Returns
Returns a value from the MessageReturnTypes enumeration indicating what action the caller should take: (Stop) This message was handled and processing should stop, (Continue) this message can be passed on to other handlers, or (Close) this handler is closed so remove from the handlers list and stop further processing.