Struct ::std::ops::Function

The type of a function in Rune.

Functions can be called using call expression syntax, such as <expr>().

There are multiple different kind of things which can be coerced into a function in Rune:

  • Regular functions.
  • Closures (which might or might not capture their environment).
  • Built-in constructors for tuple types (tuple structs, tuple variants).

Examples

// Captures the constructor for the `Some(<value>)` tuple variant.
let build_some = Some;
assert_eq!(build_some(42), Some(42));

fn build(value) {
   Some(value)
}

// Captures the function previously defined.
let build_some = build;
assert_eq!(build_some(42), Some(42));