# EffectExtensions

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/media/effects/struct-effectextensions/

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

```rust
struct EffectExtensions
```

Extension methods for effects.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/effects/effect_extensions.rs#L6)

## Members

- [`get_effect_output_padding`](#function-get_effect_output_padding)
- [`to_custom_effect`](#function-to_custom_effect)
- [`to_immutable`](#function-to_immutable)
- [`effect_equals`](#function-effect_equals)

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

### get_effect_output_padding

```rust
fn get_effect_output_padding(effect: Option<&dyn IEffect>) -> Thickness
```

How far the output of the effect extends beyond the bounds of the
content it is applied to. For a custom effect, the padding of its
snapshot (`ImmutableCustomEffect::padding`).

Panics for an effect of an unknown kind.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/effects/effect_extensions.rs#L21)

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

### to_custom_effect

```rust
fn to_custom_effect(effect: &dyn IEffect) -> Option<ImmutableCustomEffect>
```

The snapshot of a custom effect (#455, not from upstream): the effect
itself when it is an `ImmutableCustomEffect`, the snapshot of its
values when it is a custom effect class
(`Effect::construct_custom`); `None` for the other effects.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/effects/effect_extensions.rs#L55)

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

### to_immutable

```rust
fn to_immutable(effect: &Rc<dyn IEffect>) -> std::sync::Arc<dyn IImmutableEffect>
```

Converts an effect to an immutable effect: the result of
`IMutableEffect::to_immutable`
if the effect is mutable, otherwise the effect itself.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/effects/effect_extensions.rs#L69)

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

### effect_equals

```rust
fn effect_equals(immutable: Option<&dyn IImmutableEffect>, right: Option<&dyn IEffect>) -> bool
```

Whether an immutable effect and another effect are both absent or
structurally equal.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/effects/effect_extensions.rs#L78)

## Trait implementations

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

## Availability

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