6.7 Contracts
fn withdraw(acc: &var Account, amt: Money)
requires amt > Money.zero()
ensures acc.balance == old(acc.balance) - amt
{ … }requiresis checked on entry,ensureson exit (resultis the return value,old(e)is the value ofeon entry),invariant(§4.2) — after construction and aftervar fn.- Checks are enabled in the
devandtestprofiles and disabled inprod; they are controlled by the profile keycontracts. A violation is a panic.
Related diagnostics
See also
Source: docs/spec/oxl-standard.en.md