Functions and Custom Types Metadata

Requires metadata

Exporting metadata requires the metadata feature.

Functions

The metadata of a function means all relevant information related to a function’s definition including:

  1. Its callable name

  2. Its access mode (public or private)

  3. Its parameter names and types (if any)

  4. Its return value and type (if any)

  5. Its nature (i.e. native Rust or Rhai-scripted)

  6. Its namespace (module or global)

  7. Its purpose, in the form of doc-comments

  8. Usage notes, warnings, examples etc., in the form of doc-comments

A function’s signature encapsulates the first four pieces of information in a single concise line of definition:

[private] name (param 1:type 1, param 2:type 2,, param n:type n) -> return type

Custom Types

The metadata of a custom type include:

  1. Its full Rust type name

  2. Its pretty-print display name (which can be the same as its Rust type name)

  3. Its purpose, in the form of doc-comments