# Signal

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-view/reactive/struct-signal/

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

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

A value that the reactive closures reading it follow. `Copy`: a `move`
closure takes it without a clone.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.View/reactive.rs#L316)

## Members

- [`with`](#function-with)
- [`with_untracked`](#function-with_untracked)
- [`get`](#function-get)
- [`get_untracked`](#function-get_untracked)
- [`set`](#function-set)
- [`set_if_changed`](#function-set_if_changed)
- [`update`](#function-update)
- [`take`](#function-take)
- [`two_way`](#function-two_way)
- [`is_alive`](#function-is_alive)

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

### with

```rust
fn with<R>(self: &Self, f: impl FnOnce(&T) -> R) -> R
```

Calls `f` with the value, and records the read when a memo or an
effect is running.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.View/reactive.rs#L356)

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

### with_untracked

```rust
fn with_untracked<R>(self: &Self, f: impl FnOnce(&T) -> R) -> R
```

Calls `f` with the value without recording the read.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.View/reactive.rs#L362)

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

### get

```rust
fn get(self: &Self) -> T
where T: Clone
```

A copy of the value; the read is recorded.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.View/reactive.rs#L369)

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

### get_untracked

```rust
fn get_untracked(self: &Self) -> T
where T: Clone
```

A copy of the value; the read is not recorded.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.View/reactive.rs#L377)

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

### set

```rust
fn set(self: &Self, value: T)
```

Replaces the value, and runs what reads it.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.View/reactive.rs#L385)

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

### set_if_changed

```rust
fn set_if_changed(self: &Self, value: T)
where T: PartialEq
```

Replaces the value when it differs from the one held; a value that is
equal changes nothing and runs nothing.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.View/reactive.rs#L392)

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

### update

```rust
fn update(self: &Self, f: impl FnOnce(&mut T) -> ())
```

Changes the value in place, and runs what reads it.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.View/reactive.rs#L403)

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

### take

```rust
fn take(self: &Self) -> T
where T: Default
```

Takes the value, leaving the default, and runs what reads it.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.View/reactive.rs#L409)

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

### two_way

```rust
fn two_way(self: Self) -> TwoWay<T>
```

The signal as a two-way value of a property: the property follows the
signal, and a change of the property (the user typed, moved a slider)
is written into the signal.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.View/reactive.rs#L421)

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

### is_alive

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

Whether the owner of the signal is still alive.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.View/reactive.rs#L426)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`IntoValue<T>`](/docs/0.5.0/api/ferroui-view/builder/trait-intovalue/)
- [`IntoValue<Option<T>>`](/docs/0.5.0/api/ferroui-view/builder/trait-intovalue/)
- [`FromValue<T>`](/docs/0.5.0/api/ferroui-view/builder/trait-fromvalue/)
- [`FromValue<Option<T>>`](/docs/0.5.0/api/ferroui-view/builder/trait-fromvalue/)
- [`IntoProp<T, Value>`](/docs/0.5.0/api/ferroui-view/builder/trait-intoprop/)
- [`AnyValueEq`](/docs/0.5.0/api/ferroui-view/element/trait-anyvalueeq/)
- `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`
- [`TreeModel`](/docs/0.5.0/api/ferroui-treedatagrid-core/accessor/trait-treemodel/)
- [`IntoProp<T, FromSignal<V>>`](/docs/0.5.0/api/ferroui-view/builder/trait-intoprop/)
- `Clone`
- `Copy`
- `PartialEq`
- `Debug`

## Availability

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