pub struct HandlerChain {
    message_handlers: Vec<Box<RefCell<dyn IMessageHandler>>>,
}
Expand description

Represents a list of handlers that all implement the IMessageHandler trait. This list can be dynamically updated and each element in the list is passed messages for processing.

Fields§

§message_handlers: Vec<Box<RefCell<dyn IMessageHandler>>>

The list of message handlers.

Implementations§

source§

impl HandlerChain

source

pub fn new() -> HandlerChain

Constructor.

Returns

Returns a new instance of the HandlerChain struct.

source

pub fn add_handler(&mut self, handler: impl IMessageHandler + 'static)

Add the given instance of the IMessageHandler interface to end of the list of handlers.

Normally this would guard against adding the same window twice, but this HandlerChain takes ownership of the window and therefore the same window can never be added twice to this HandlerChain.

source

pub fn remove_handler(&mut self, handler_id: i32)

Remove an instance of the IMessageHandler interface from the list.

If the message handler is not in the list, the request to remove is ignored.

source

pub fn send_message(&mut self, message: &Message)

Send a message to each of the handlers in the list.

Parameters
  • message

    The Message object to send to each handler.

Trait Implementations§

source§

impl Display for HandlerChain

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Convert this HandlerChain to a string that is returned.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

source§

fn vzip(self) -> V