Use
The use
item in the Cairo programming language is used to make an item from another module
directly accessible in the current module.
mod foo {
fn bar() {
// ...
}
}
// Bring the `bar` function into the current module.
use foo::bar;
fn main() {
bar();
}
The syntax for use
is use path::to::item;
, where path::to::item
is as described in
Paths.
The position of the use
item does not matter (like any other item), but it is recommended to put
them in the beginning of the module.