# IMessageBusExt

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-reactiveui/routing/trait-imessagebusext/

**trait** · [`ferroui-reactiveui`](/docs/0.5.0/api/ferroui-reactiveui/) · v0.5.0

```rust
trait IMessageBusExt
```

The typed operations of a message bus (the generic methods of `IMessageBus`), on its shared
handle: `Rc<MessageBus>` and `Rc<dyn IMessageBus>` have them.

The type of the message is a type parameter; a message type has a default value, which
`listen_include_latest` gives before any message was sent
(upstream's `default(T)`). A contract of `None` is upstream's `null`.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/routing/message_bus.rs#L133)

## Members

- [`register_scheduler`](#function-register_scheduler)
- [`register_scheduler_with_contract`](#function-register_scheduler_with_contract)
- [`listen`](#function-listen)
- [`listen_with_contract`](#function-listen_with_contract)
- [`listen_include_latest`](#function-listen_include_latest)
- [`listen_include_latest_with_contract`](#function-listen_include_latest_with_contract)
- [`register_message_source`](#function-register_message_source)
- [`register_message_source_with_contract`](#function-register_message_source_with_contract)
- [`send_message`](#function-send_message)
- [`send_message_with_contract`](#function-send_message_with_contract)

<a id="function-register_scheduler"></a>

### register_scheduler

```rust
fn register_scheduler<T: 'static>(self: &Self, scheduler: Rc<dyn IScheduler>)
```

Registers the scheduler that delivers the messages of `T` without a contract, replacing
the one registered before (`RegisterScheduler<T>(IScheduler)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/routing/message_bus.rs#L136)

<a id="function-register_scheduler_with_contract"></a>

### register_scheduler_with_contract

```rust
fn register_scheduler_with_contract<T: 'static>(self: &Self, scheduler: Rc<dyn IScheduler>, contract: Option<&str>)
```

Registers the scheduler that delivers the messages of `T` with `contract`
(`RegisterScheduler<T>(IScheduler, string?)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/routing/message_bus.rs#L140)

<a id="function-listen"></a>

### listen

```rust
fn listen<T: Clone + Default + 'static>(self: &Self) -> Rc<dyn IObservable<T>>
```

The messages of `T` sent after the subscription (`Listen<T>()`). The channel is created
when the observable is subscribed.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/routing/message_bus.rs#L144)

<a id="function-listen_with_contract"></a>

### listen_with_contract

```rust
fn listen_with_contract<T: Clone + Default + 'static>(self: &Self, contract: Option<&str>) -> Rc<dyn IObservable<T>>
```

The messages of `T` with `contract` sent after the subscription (`Listen<T>(string?)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/routing/message_bus.rs#L147)

<a id="function-listen_include_latest"></a>

### listen_include_latest

```rust
fn listen_include_latest<T: Clone + Default + 'static>(self: &Self) -> Rc<dyn IObservable<T>>
```

The latest message of `T` (or its default value) at once, then the later ones
(`ListenIncludeLatest<T>()`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/routing/message_bus.rs#L151)

<a id="function-listen_include_latest_with_contract"></a>

### listen_include_latest_with_contract

```rust
fn listen_include_latest_with_contract<T: Clone + Default + 'static>(self: &Self, contract: Option<&str>) -> Rc<dyn IObservable<T>>
```

The latest message of `T` with `contract`, then the later ones
(`ListenIncludeLatest<T>(string?)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/routing/message_bus.rs#L155)

<a id="function-register_message_source"></a>

### register_message_source

```rust
fn register_message_source<T: Clone + Default + 'static>(self: &Self, source: Rc<dyn IObservable<T>>) -> Rc<dyn IDisposable>
```

Sends each value of `source` as a message of `T`, until the returned disposable is
disposed; an error or the end of `source` is logged and leaves the channel open
(`RegisterMessageSource<T>(IObservable<T>)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/routing/message_bus.rs#L160)

<a id="function-register_message_source_with_contract"></a>

### register_message_source_with_contract

```rust
fn register_message_source_with_contract<T: Clone + Default + 'static>(self: &Self, source: Rc<dyn IObservable<T>>, contract: Option<&str>) -> Rc<dyn IDisposable>
```

`register_message_source` on the channel of `contract`
(`RegisterMessageSource<T>(IObservable<T>, string?)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/routing/message_bus.rs#L164)

<a id="function-send_message"></a>

### send_message

```rust
fn send_message<T: Clone + Default + 'static>(self: &Self, message: T)
```

Sends one message of `T` (`SendMessage<T>(T)`). For messages that answer other changes,
`register_message_source` is the better fit.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/routing/message_bus.rs#L172)

<a id="function-send_message_with_contract"></a>

### send_message_with_contract

```rust
fn send_message_with_contract<T: Clone + Default + 'static>(self: &Self, message: T, contract: Option<&str>)
```

Sends one message of `T` on the channel of `contract` (`SendMessage<T>(T, string?)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/routing/message_bus.rs#L175)

## Trait implementations

- [`IMessageBusExt`](/docs/0.5.0/api/ferroui-reactiveui/routing/trait-imessagebusext/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
