# Lookup

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-reactive/linq/struct-lookup/

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

```rust
struct Lookup<K, E>
```

Keys, each with the elements added under it (`ILookup<TKey, TElement>`, implemented by
`System.Reactive.Lookup<K, E>`): an ordered map of keys to their elements, iterated in the order
the keys were first added.

Deviation (DEVIATIONS.md, Reactive): upstream compares keys with an `IEqualityComparer<TKey>`
and enumerates the groups in the order of its dictionary (the order the keys were added, for a
dictionary that nothing was removed from); the port compares keys with `Eq` and `Hash` and keeps
that order explicitly.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Reactive/linq/to_lookup.rs#L55)

## Members

- [`new`](#function-new)
- [`add`](#function-add)
- [`get`](#function-get)
- [`contains`](#function-contains)
- [`count`](#function-count)
- [`is_empty`](#function-is_empty)
- [`iter`](#function-iter)

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

### new

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

An empty lookup.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Reactive/linq/to_lookup.rs#L62)

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

### add

```rust
fn add(self: &mut Self, key: K, element: E)
```

Adds `element` under `key` (`Add`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Reactive/linq/to_lookup.rs#L67)

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

### get

```rust
fn get<Q>(self: &Self, key: &Q) -> &[E]
where K: Borrow<Q>,
      Q: Eq + Hash + ?Sized
```

The elements under `key`, empty when there are none (the indexer `this[TKey]`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Reactive/linq/to_lookup.rs#L78)

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

### contains

```rust
fn contains<Q>(self: &Self, key: &Q) -> bool
where K: Borrow<Q>,
      Q: Eq + Hash + ?Sized
```

Whether there are elements under `key` (`Contains`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Reactive/linq/to_lookup.rs#L90)

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

### count

```rust
fn count(self: &Self) -> usize
```

The number of keys (`Count`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Reactive/linq/to_lookup.rs#L101)

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

### is_empty

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

Whether there are no keys.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Reactive/linq/to_lookup.rs#L106)

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

### iter

```rust
fn iter(self: &Self) -> std::slice::Iter<'_, Grouping<K, E>>
```

The groups, in the order their keys were first added (`GetEnumerator`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Reactive/linq/to_lookup.rs#L111)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- `Clone`
- `Default`
- `IntoIterator`
- `PartialEq`
- `Eq`
- `Debug`

## Availability

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