# AggregateNumber

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-dynamic-data/aggregation/trait-aggregatenumber/

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

```rust
trait AggregateNumber: Copy + PartialEq + PartialOrd + Debug + 'static
```

A number that the aggregations add up and average (`int`, `long`, `float`, `double`).

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/aggregation/aggregate_number.rs#L17)

## Members

- [`Average`](#assoc_type-average)
- [`ZERO`](#assoc_const-zero)
- [`plus`](#function-plus)
- [`minus`](#function-minus)
- [`average`](#function-average)
- [`to_average`](#function-to_average)

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

### Average

```rust
type Average: Copy + PartialEq + PartialOrd + Debug + 'static
```

The type of an average: `f64` for `i32`, `i64` and `f64` (`double`), `f32` for `f32`
(`float`), as upstream's overloads of `Avg` return.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/aggregation/aggregate_number.rs#L20)

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

### ZERO

```rust
const ZERO: Self
```

Zero, the sum of no values.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/aggregation/aggregate_number.rs#L23)

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

### plus

```rust
fn plus(self: Self, other: Self) -> Self
```

`self + other`, wrapping on overflow for the integers.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/aggregation/aggregate_number.rs#L26)

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

### minus

```rust
fn minus(self: Self, other: Self) -> Self
```

`self - other`, wrapping on overflow for the integers.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/aggregation/aggregate_number.rs#L29)

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

### average

```rust
fn average(sum: Self, count: i32) -> <Self as >::Average
```

The average of `count` values (at least one) whose sum is `sum`: `sum / (double)count` for
the integers and `double`, `sum / count` in `float` for `float`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/aggregation/aggregate_number.rs#L33)

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

### to_average

```rust
fn to_average(self: Self) -> <Self as >::Average
```

The number as an average (the implicit conversion of upstream's `emptyValue`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/aggregation/aggregate_number.rs#L36)

## Trait implementations

- [`AggregateNumber`](/docs/0.5.0/api/ferroui-dynamic-data/aggregation/trait-aggregatenumber/)

## Availability

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