IMessageBus
trait · ferroui-reactiveui · v0.5.0
trait IMessageBus: IEnableLogger
A message bus: a simple way for view models and other objects to talk to each other without
knowing each other (IMessageBus).
Which messages go where is decided by the type of the message and a contract, a string that tells apart the messages of the same type and that the client chooses.
The typed operations of upstream (Listen<T>, SendMessage<T>, RegisterMessageSource<T>,
RegisterScheduler<T>, ...) are the methods of IMessageBusExt,
which every shared handle of a bus (Rc<MessageBus>, Rc<dyn IMessageBus>) has; they go
through the methods of this trait.
Members
register_scheduler_for
fn register_scheduler_for(self: &Self, key: MessageKey, scheduler: Rc<dyn IScheduler>)
Registers the scheduler that delivers the messages of a channel, replacing the one
registered before (RegisterScheduler<T>(IScheduler, string?)).
is_registered_with_contract
fn is_registered_with_contract(self: &Self, message_type: TypeId, contract: Option<&str>) -> bool
Whether the channel of message_type and contract is registered: a message was sent on
it, or something listened to it (IsRegistered(Type, string?)).
is_registered
fn is_registered(self: &Self, message_type: TypeId) -> bool
Whether the channel of message_type without a contract is registered
(IsRegistered(Type)).
message_subject
fn message_subject(self: &Self, key: &MessageKey, create: &dyn Fn(Rc<dyn IScheduler>) -> Rc<dyn Any>) -> Rc<dyn Any>
The subject of the messages of a channel, created with create the first time, given the
scheduler registered for the channel (SetupSubjectIfNecessary<T>). The subject is an
Rc<ScheduledSubject<T>> of the type of the messages, type-erased.
Trait implementations
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.