# MethodHelper

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-xaml-interactivity/helpers/struct-methodhelper/

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

```rust
struct MethodHelper
```

Finds the method a call-method action calls on its target: a public method of the name that
returns nothing (or a task) and takes no parameters, or two parameters of which the first is
an untyped value (the sender).

Deviation (DEVIATIONS.md, Behaviors): the methods are the methods of the markup metadata of
the type of the target (`GetRuntimeMethods()` of the reference); see
`member_lookup`.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactivity/helpers/method_helper.rs#L41)

## Members

- [`new`](#function-new)
- [`has_target_object_type`](#function-has_target_object_type)
- [`find_best_method`](#function-find_best_method)
- [`update_target_type`](#function-update_target_type)
- [`update_method_descriptors`](#function-update_method_descriptors)

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

### new

```rust
fn new() -> Self
```

Creates a helper with no target.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactivity/helpers/method_helper.rs#L50)

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

### has_target_object_type

```rust
fn has_target_object_type(self: &Self) -> bool
```

Whether the helper has a target type (`TargetObjectType is not null`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactivity/helpers/method_helper.rs#L55)

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

### find_best_method

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

Finds the method whose second parameter is closest to the type of `parameter`, or the
parameterless method (or the one method that accepts null as its second parameter).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactivity/helpers/method_helper.rs#L61)

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

### update_target_type

```rust
fn update_target_type(self: &Self, target: &BoxedValue, method_name: Option<&str>)
```

Sets the target the methods are found on, and finds the methods named `method_name` when
the type of the target changed (`UpdateTargetType(target.GetType(), methodName)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactivity/helpers/method_helper.rs#L95)

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

### update_method_descriptors

```rust
fn update_method_descriptors(self: &Self, method_name: Option<&str>)
```

Finds the methods named `method_name` on the target.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactivity/helpers/method_helper.rs#L112)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- `Default`

## Availability

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