Makrolar
The Cairo language has some plugins that allow developers to simplify their code. They are called inline_macros
and are a way of writing code that generates other code.
consteval_int!
Macro
Bazı durumlarda, bir geliştirici tamsayıların bir hesaplamasının sonucu olan bir sabiti bildirmeye ihtiyaç duyabilir. Sabit bir ifadeyi hesaplamak ve sonucunu derleme zamanında kullanmak için consteval_int!
makrosunu kullanmak gereklidir.
consteval_int!
örneği:
const a: felt252 = consteval_int!(2 * 2 * 2);
Bu, derleyici tarafından const a: felt252 = 8;
olarak yorumlanacaktır.
selector!
Macro
selector!("function_name")
macro generates the entry point selector for the given function name.
print!
and println!
Macros
Please refer to the Printing page.
array!
Macro
Lütfen Diziler sayfasına bakınız.
panic!
Macro
See Unrecoverable Errors with panic page.
assert!
and assert_xx!
Macros
See How to Write Tests page.
format!
Macro
See Printing page.
write!
and writeln!
Macros
See Printing page.
get_dep_component!
, get_dep_component_mut
and component!
Macros
Please refer to the Composability and Components chapter.