# MarkupEvent

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/metadata/struct-markupevent/

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

```rust
struct MarkupEvent
```

An event that is not a routed event: handlers are attached through
`add` (or `subscribe`).

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/metadata/markup_type.rs#L717)

## Members

- [`name`](#struct_field-name)
- [`arguments`](#struct_field-arguments)
- [`add`](#struct_field-add)
- [`subscribe`](#function-subscribe)
- [`subscription_of`](#function-subscription_of)
- [`subscription_value`](#function-subscription_value)

<a id="struct_field-name"></a>

### name

```rust
name: &'static str
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/metadata/markup_type.rs#L718)

<a id="struct_field-arguments"></a>

### arguments

```rust
arguments: &'static [TypeOf]
```

The types of the arguments the event passes to its handlers
(sender first, where the event has one).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/metadata/markup_type.rs#L721)

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

### add

```rust
add: MarkupInvoke
```

Subscribes a handler: `(instance, handler)`, where the handler is a
`MarkupDelegate` called with the event arguments in untyped form.
Returns the subscription as an untyped `Rc<dyn IDisposable>`
(`subscription_of`), or null when the event
offers no way to remove the handler.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/metadata/markup_type.rs#L727)

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

### subscribe

```rust
fn subscribe(self: &Self, target: MarkupValue, handler: MarkupDelegate) -> Result<Option<Rc<dyn IDisposable>>, MarkupInvokeError>
```

Attaches `handler` to the event of `target` (the `add` accessor of the
managed event, `EventInfo.AddEventHandler`) and returns the
subscription: disposing it removes the handler (the `remove`
accessor, `EventInfo.RemoveEventHandler`). `Ok(None)` when the event
declares no way to remove a handler.

`target` is the instance in untyped form, as for every member
invoker. The error is the one of `add`: a target that is not an
instance of the declaring type, or the failure of a fallible
subscription.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/metadata/markup_type.rs#L741)

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

### subscription_of

```rust
fn subscription_of(value: &MarkupValue) -> Option<Rc<dyn IDisposable>>
```

The subscription in the result of `add`: the untyped
`Rc<dyn IDisposable>` the declaration boxed, `None` for null.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/metadata/markup_type.rs#L753)

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

### subscription_value

```rust
fn subscription_value(subscription: impl IntoMarkupSubscription) -> MarkupValue
```

The result of `add` for what a subscription function returned: the
disposable boxed as an untyped value, null for none. Used by the
`events:` declarations of the metadata macros, and by a hand-written
`add`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/metadata/markup_type.rs#L761)

## Trait implementations

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

## Availability

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