# AutoCompleteFilterPredicate

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls/struct-autocompletefilterpredicate/

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

```rust
struct AutoCompleteFilterPredicate<T: 'static>
```

Represents the filter used by the [`AutoCompleteBox`](/docs/0.5.0/api/ferroui-controls/struct-autocompletebox/) control to
determine whether an item is a possible match for the specified text.

The function takes the string used as the basis for filtering and the
item that is compared with it, and returns `true` to indicate the item
is a possible match. `T` is the type used for filtering: the text form
of an item (`Option<String>`) or the item itself
(`Option<BoxedValue>`).

A filter is a reference: copies compare equal to what they were copied
from, two filters made from the same function do not.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_complete_box/auto_complete_box.rs#L63)

## Members

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

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

### new

```rust
fn new(filter: impl Fn(Option<&str>, &T) -> bool + 'static) -> Self
```

Wraps a filter function.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_complete_box/auto_complete_box.rs#L67)

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

### invoke

```rust
fn invoke(self: &Self, search: Option<&str>, item: &T) -> bool
```

Calls the filter.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_complete_box/auto_complete_box.rs#L72)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- [`PropertyValue`](/docs/0.5.0/api/ferroui-base/trait-propertyvalue/)
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- `Clone`
- `PartialEq`

## Availability

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