# Trait num_traits::identities::One [−] [src]

    pub trait One: Mul<Self, Output = Self> {
        fn one() -> Self;

        fn is_one(&self) -> bool
        where
            Self: PartialEq<Self>,
        { ... }
    }

Defines a multiplicative identity element for `Self`.

## Required Methods

### `fn one() -> Self`

Returns the multiplicative identity element of `Self`, `1`.

# Laws

    a * 1 = a       ∀ a ∈ Self
    1 * a = a       ∀ a ∈ Self

# Purity

This function should return the same result at all times regardless of external mutable state, for example values stored in TLS or in `static mut`s.

## Provided Methods

### `fn is_one(&self) -> bool where
Self: PartialEq<Self>,`

Returns `true` if `self` is equal to the multiplicative identity.

For performance reasons, it's best to implement this manually. After a semver bump, this method will be required, and the `where Self: PartialEq` bound will be removed.

## Implementations on Foreign Types

### `impl One for isize`
[src]

#### `fn one() -> isize`
[src]

#### `fn is_one(&self) -> bool where
Self: PartialEq<Self>,`
[src]

### `impl One for u64`
[src]

#### `fn one() -> u64`
[src]

#### `fn is_one(&self) -> bool where
Self: PartialEq<Self>,`
[src]

### `impl One for usize`
[src]

#### `fn one() -> usize`
[src]

#### `fn is_one(&self) -> bool where
Self: PartialEq<Self>,`
[src]

### `impl One for i16`
[src]

#### `fn one() -> i16`
[src]

#### `fn is_one(&self) -> bool where
Self: PartialEq<Self>,`
[src]

### `impl One for u16`
[src]

#### `fn one() -> u16`
[src]

#### `fn is_one(&self) -> bool where
Self: PartialEq<Self>,`
[src]

### `impl One for u32`
[src]

#### `fn one() -> u32`
[src]

#### `fn is_one(&self) -> bool where
Self: PartialEq<Self>,`
[src]

### `impl One for i32`
[src]

#### `fn one() -> i32`
[src]

#### `fn is_one(&self) -> bool where
Self: PartialEq<Self>,`
[src]

### `impl One for i64`
[src]

#### `fn one() -> i64`
[src]

#### `fn is_one(&self) -> bool where
Self: PartialEq<Self>,`
[src]

### `impl One for f64`
[src]

#### `fn one() -> f64`
[src]

#### `fn is_one(&self) -> bool where
Self: PartialEq<Self>,`
[src]

### `impl One for i8`
[src]

#### `fn one() -> i8`
[src]

#### `fn is_one(&self) -> bool where
Self: PartialEq<Self>,`
[src]

### `impl One for u8`
[src]

#### `fn one() -> u8`
[src]

#### `fn is_one(&self) -> bool where
Self: PartialEq<Self>,`
[src]

### `impl One for f32`
[src]

#### `fn one() -> f32`
[src]

#### `fn is_one(&self) -> bool where
Self: PartialEq<Self>,`
[src]

### `impl<T> One for Wrapping<T> where
T: One,
Wrapping<T>: Mul<Wrapping<T>>,
<Wrapping<T> as Mul<Wrapping<T>>>::Output == Wrapping<T>,`
[src]

#### `fn one() -> Wrapping<T>`
[src]

#### `fn is_one(&self) -> bool where
Self: PartialEq<Self>,`
[src]

## Implementors

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)