Attribute Macro creusot_contracts::macros::logic

#[logic]
Expand description

Declare a function as being a logical function

This declaration must be pure and total. It cannot be called from Rust programs, but in exchange it can use logical operations and syntax with the help of the pearlite! macro.

§prophetic

If you wish to use the ^ operator on mutable borrows to get the final value, you need to specify that the function is prophetic, like so:

#[logic(prophetic)]
fn uses_prophecies(x: &mut Int) -> Int {
    pearlite! { if ^x == 0 { 0 } else { 1 } }
}

Such a logic function cannot be used in snapshot! anymore, and cannot be called from a regular logic or predicate function.