# CommandInvoker

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-reactiveui/binding/command_binding/struct-commandinvoker/

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

```rust
struct CommandInvoker
```

Executes a command with each value of an observable as its parameter, skipping a value the
command cannot execute (`CommandInvoker`).

An error of the values, or of the observable of commands, is rethrown where it is raised
(`ExceptionDispatchInfo.Throw`): here it panics with its message.

Deviation (DEVIATIONS.md, ReactiveUI): the overload on an observable of commands is
`invoke_observed`; the null checks of the arguments have no
counterpart.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/binding/command_binding/command_invoker.rs#L20)

## Members

- [`invoke`](#function-invoke)
- [`invoke_observed`](#function-invoke_observed)

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

### invoke

```rust
fn invoke<T: 'static>(source: &Rc<dyn IObservable<T>>, command: Rc<dyn ICommand>) -> Rc<dyn IDisposable>
```

Executes `command` with each value of `source` that it can execute
(`Invoke<T>(IObservable<T>, ICommand)`); disposing the result stops it.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/binding/command_binding/command_invoker.rs#L25)

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

### invoke_observed

```rust
fn invoke_observed<T: 'static>(source: &Rc<dyn IObservable<T>>, commands: &Rc<dyn IObservable<Option<Rc<dyn ICommand>>>>) -> Rc<dyn IDisposable>
```

Executes the latest command of `commands` with each value of `source` that it can execute,
and nothing while there is none (`Invoke<T>(IObservable<T>, IObservable<ICommand?>)`);
disposing the result ends both subscriptions.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/binding/command_binding/command_invoker.rs#L32)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`

## Availability

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