Keyword auto-imported

uses

Source: compiler/src/builtin_docs/keywords.md

Declares the effects a function may have: uses {read, write}.

The effects are read, write, net, env, exec, ffi, thread, suspend and mutate. The compiler checks the list against what the body does (error E0413); uses {} means the same as pure. Contextual: only a keyword after the signature (and its where clause).

static let hits = 0;

fn bump() uses {read, mutate} {
    hits = hits + 1;
}

See also#

  • io::net
  • env
  • ffi
  • thread
  • fn: Declares a function, a method, or (written in an expression) an anonymous function.
  • let: Declares a mutable local variable.
  • const: Declares a binding that cannot be reassigned: a local, a module constant, or a class field that is set only by new.
  • static: Declares a module-level or class-level slot shared by the whole program, or a method without self.
↑ ↓ navigate ↵ open