Skip to main content

Module cfg

Module cfg 

Source
Expand description

Compile-time configuration: the names @cfg(...) tests.

An item or statement written after @cfg(predicate) is compiled only when the predicate holds, and is dropped before name resolution otherwise, so the code it holds never has to resolve. candela names no configuration of its own. The program embedding it decides which flags are on, the way a host compiling for a browser turns on web:

use candela::Cfg;

let mut cfg = Cfg::new();
cfg.enable("web");
cfg.enable_value("target", "wasm32");
let engine = candela::Engine::new().with_cfg(cfg);

A compile that does not go through an crate::Engine runs inside Cfg::scope instead. A flag nobody enabled is false.

Structsยง

Cfg
The flags and key = "value" pairs a compile treats as true.