# EventPatternSourceBase

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

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

```rust
struct EventPatternSourceBase<S, A>
```

The base of an event that notifies the event patterns of a sequence
(`EventPatternSourceBase<TSender, TEventArgs>`): each handler added subscribes to the sequence,
and `invoke_handler` hands it each pattern; the handler leaves when the sequence ends, and an
error of the sequence panics after it has left (upstream rethrows the error).

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

## Members

- [`new`](#function-new)
- [`add`](#function-add)
- [`remove`](#function-remove)

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

### new

```rust
fn new(source: Rc<dyn IObservable<EventPattern<S, A>>>, invoke_handler: impl Fn(&dyn Fn(S, A) -> (), EventPattern<S, A>) -> () + 'static) -> Self
```

The event of the patterns of `source`, which `invoke_handler` hands to a handler
(`EventPatternSourceBase(IObservable<EventPattern<TSender, TEventArgs>>, Action<Action<TSender, TEventArgs>, EventPattern<TSender, TEventArgs>>)`).

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

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

### add

```rust
fn add(self: &Self, invoke: Rc<dyn Fn(S, A) -> ()>) -> u64
```

Adds a handler, `invoke` (`Add(Delegate, Action<TSender, TEventArgs>)`), subscribed to the
sequence; returns the token that removes it.

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

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

### remove

```rust
fn remove(self: &Self, token: u64) -> bool
```

Removes the handler of `token` and disposes its subscription (`Remove(Delegate)`). False when
the token is unknown.

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

## 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/).
