Expand description
The “standard library” of Creusot.
To start using Creusot, you should always import that crate. The recommended way is to have a glob import:
use creusot_contracts::prelude::*;§Writing specifications
To start writing specification, use the requires and ensures macros:
use creusot_contracts::prelude::*;
#[requires(x < i32::MAX)]
#[ensures(result@ == x@ + 1)]
fn add_one(x: i32) -> i32 {
x + 1
}For a more detailed explanation, see the guide.
§Module organization
Modules§
- cell
- Interior mutability
- ghost
- Definitions for ghost code
- invariant
- Type invariants
- logic
- Definitions for pearlite code
- macros
- Specification are written using these macros
- model
- Logical models of types:
ViewandDeepModel - peano
- Peano integers
- prelude
- Re-exports available under the
creusot_contractsnamespace - resolve
- Resolve mutable borrows
- snapshot
- Definition of
Snapshot - std
- Specifications for the
stdcrate
Macros§
- ord_
laws_ impl - A macro to easily implements the various
#[logic(law)]s ofOrdLogic. - vec
- Creusot-friendly replacement of
vec!