Config structv0.1.0

Source
The set of user-defined build values.
pub struct Config {}

Carries no fields: the values live in the build rather than in the value, and are reached through the two queries below. #config is the only instance.

Methods

Get

pub func Get(self: &Config, name: char8[..]) -> char8[..]

The value defined for name, or an empty slice when none was. self is borrowed and name must be a string literal, since this is answered while compiling. Returns a borrowed view of the build's own storage, which outlives the program. An absent name and a name defined as empty both yield an empty slice; use Has to tell them apart. Cannot fail. Costs nothing in the built program.

NameTypeDescription
namechar8[..]the build value's name

Returns: its value, or an empty slice when the build defines none

Source

Has

pub func Has(self: &Config, name: char8[..]) -> bool

Whether name was defined at all, whatever its value. self is borrowed and name must be a string literal. Answered while compiling. Cannot fail. Costs nothing in the built program.

NameTypeDescription
namechar8[..]the build value's name

Returns: whether the build defines it

Source

#config

pub const #config: Config;

The build's user-defined values, as a compile-time value.

Source