> ## Documentation Index
> Fetch the complete documentation index at: https://docs.starknet.io/llms.txt
> Use this file to discover all available pages before exploring further.

# core::ops::function::FnOnce

The version of the call operator that takes a by-value receiver.
Instances of `FnOnce` can be called, but might not be callable multiple
times. Because of this, if the only thing known about a type is that it
implements `FnOnce`, it can only be called once.
`FnOnce` is implemented automatically by closures that might consume captured
variables.

## Signature

```rust theme={null}
pub trait FnOnce
```

## Examples

```rust theme={null}
fn consume_with_relish, +core::ops::FnOnce[Output: O], +core::fmt::Display, +Drop,
>(
    func: F,
) {
    // `func` consumes its captured variables, so it cannot be run more
    // than once.
    println!("Consumed: {}", func());

    println!("Delicious!");
    // Attempting to invoke `func()` again will throw a `Variable was previously moved.`
    // error for `func`.
}

  let x: ByteArray = "x";
  let consume_and_return_x = || x;
  consume_with_relish(consume_and_return_x);
  // `consume_and_return_x` can no longer be invoked at this point
```

## Trait functions

### call

Performs the call operation.

#### Signature

```rust theme={null}
fn call(self: T, args: Args) -> FnOnceOutput
```

## Trait types

### Output

The returned type after the call operator is used.

#### Signature

```rust theme={null}
type Output;
```
