# ICommand

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/data/model/trait-icommand/

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

```rust
trait ICommand
```

Defines a command.

Commands compare by reference.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/i_command.rs#L8)

## Members

- [`can_execute`](#function-can_execute)
- [`execute`](#function-execute)
- [`can_execute_changed`](#function-can_execute_changed)

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

### can_execute

```rust
fn can_execute(self: &Self, parameter: Option<&BoxedValue>) -> bool
```

Defines the method that determines whether the command can execute
in its current state. `parameter` is data used by the command; if
the command does not require data, it can be `None`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/i_command.rs#L12)

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

### execute

```rust
fn execute(self: &Self, parameter: Option<&BoxedValue>)
```

Defines the method to be called when the command is invoked.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/i_command.rs#L15)

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

### can_execute_changed

```rust
fn can_execute_changed(self: &Self, handler: Rc<dyn Fn() -> ()>) -> Rc<dyn IDisposable>
```

Occurs when changes occur that affect whether or not the command
should execute. Disposing the returned handle unsubscribes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/i_command.rs#L19)

## Trait implementations

- [`ICommand`](/docs/0.5.0/api/ferroui-base/data/model/trait-icommand/)

## Availability

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