# Summable

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-reactive/linq/trait-summable/

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

```rust
trait Summable: Sized + 'static
```

A type `Sum` adds up (upstream's overloads of `Sum` for `int`, `long`, `float`, `double` and
their nullable forms). The sum has the type of the values; the sum of an `Option` sequence
ignores the `None` values and is always a `Some` (`0` for no values).

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

## Members

- [`Sum`](#assoc_type-sum)
- [`ZERO`](#assoc_const-zero)
- [`add`](#function-add)
- [`total`](#function-total)

<a id="assoc_type-sum"></a>

### Sum

```rust
type Sum: Copy + 'static
```

The running sum: the type itself, `f64` for `f32` (as LINQ to Objects, which accumulates a
`float` sum into a `double`).

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

<a id="assoc_const-zero"></a>

### ZERO

```rust
const ZERO: <Self as >::Sum
```

The sum of no values.

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

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

### add

```rust
fn add(sum: <Self as >::Sum, value: Self) -> Option<<Self as >::Sum>
```

`sum` plus `value` (`sum` itself for a `None`), or `None` when the sum does not fit (the
`checked` addition of `int` and `long`, which throws `OverflowException`).

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

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

### total

```rust
fn total(sum: <Self as >::Sum) -> Self
```

The sum as the value of the sequence.

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

## Trait implementations

- [`Summable`](/docs/0.5.0/api/ferroui-reactive/linq/trait-summable/)

## Availability

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