Cargo Features

[dependencies]
knightrs = { version = "0.8.12", default-features = false, features = ["cache-strings", "abort-on-errors", "optimized", "unsafe-enabled", "unsafe-single-threaded", "unsafe-reckless", "unsafe-optimized", "assign-to-anything", "unary-negation", "variable-lookup", "extensions", "disallow-unicode", "checked-overflow", "strict-numbers", "strict-block-return-value", "strict-compliance", "clap"] }
default = extensions

The extensions feature is set by default whenever knightrs is added without default-features = false somewhere in the dependency tree.

cache-strings optimized? unsafe-optimized?

Optimizations


Leak strings for fast access later.

abort-on-errors optimized?

Instead of propagating exceptions, abort when an error occurs.

optimized = abort-on-errors, cache-strings

Enable all optimizations

unsafe-enabled unsafe-reckless? unsafe-single-threaded?
 `Unsafe`  Optimizations      

Indicates unsafe code is enabled; used to deny unsafe code otherwise.

unsafe-single-threaded unsafe-optimized? = unsafe-enabled

Assume knight will be run in one thread.

WARNING: this can cause undefined behaviour if multiple threads use knight.

unsafe-reckless unsafe-optimized? = unsafe-enabled

Assume that all knight programs are 100% well-defined.

WARNING: This will cause undefined behaviour if anything goes wrong, such as a system call failing. This should be used with caution.

If abort-on-errors is enabled, this will be ignored.

unsafe-optimized = cache-strings, unsafe-reckless, unsafe-single-threaded

Enable all optimizations for knight

WARNING: Read the descriptions of each unsafe feature to prevent undefined behaviour.

assign-to-anything extensions

Knight Extensions


Allow programs to assign to non-variables by converting to value to a variable first.

unary-negation extensions

Enables the ~ function, which is used for unary negation.

Affects function::neg

variable-lookup extensions

Enables the V function, which can be used to dynamically look variables up without EVAL.

Affects function::variable_lookup

extensions default = assign-to-anything, unary-negation, variable-lookup

Just enable all extensions.

disallow-unicode strict-compliance?

Spec Compliance


Restrict source files and strings to the bytes defined in the Knight spec.

checked-overflow strict-compliance?

Catch undefined integer arithmetic

strict-numbers strict-compliance?

Use i32 for numbers, which is the minimum required range.

strict-block-return-value strict-compliance?

Ensure BLOCK return values are handled correctly.

strict-compliance = checked-overflow, disallow-unicode, strict-block-return-value, strict-numbers

Exactly follow knight specs.

Features from optional dependencies

clap implicit feature

Enables clap ^2.33

clap:

A simple to use, efficient, and full-featured Command Line Argument Parser

Required by the knight binary