Public Assignments
Public assignments provide a value to the inner and the outer of a module.
mod my_module {
pub mod sub_module {
pub const TEXT = "Hello";
}
}
std::print(my_module::sub_module::TEXT);
Restrictions
Not in workbenches
Using pub is not allowed within workbenches:
sketch MySketch() {
pub const TEXT = "Hello"; // error
std::print(TEXT);
}
MySketch();
Not in functions
fn f() {
const MY_CONST = 1; // error: not allowed in functions
}
f();