Skip to main content

Module model

Module model 

Source
Expand description

The syntax of #[leanfran::model], shared by the macro, the build script and cargo leanfran: the attribute keys, the signature of a modelled function, its loops, and the items of a crate with the hashes of their tokens.

Structs§

CrateItems
What a scan of src/**/*.rs finds.
Exported
The arguments of #[leanfran::exported(..)]: the Lean name, and for a generic function generated from rust_instances the type parameters of the Lean function and its instantiations by Rust type (type_params = ["α"], instances = [("u32", "f.inst_U32")]).
ModelAttr
The keys of #[leanfran::model(..)].
ModelFn
A modelled function of the crate.
OpaqueFn
A function of #[leanfran::opaque], or a method of an inherent impl block with it.
Param
Sig
TypeParam
A type parameter of a generic function, with the traits of its bounds (the last segments of their paths).
Uses
A use of a module: the local name and the path it stands for.

Enums§

LoopNode
A loop of a function body or a macro call (whose loops are not visible).
Mode
How a parameter is passed.
ObligationMode
How the obligations of a generic function are stated.
SpecRef
A spec named by an attribute key.

Functions§

file_module
Module path of a file relative to the crate root: src/a/b.rs and src/a/b/mod.rs → [a, b]; src/lib.rs, src/main.rs and src/bin/*.rs are crate roots.
instance_name
The part of a name standing for a type: u32, Vec_u32, u32_String.
is_attr
true for #[model], #[leanfran::model] and #[::leanfran::model].
item_hash
sha256:<hex> of the tokens of item without its doc comments.
loops
The loops of a function body, as a tree of nesting.
model_attr
The keys of the #[leanfran::model] attributes of attrs, if there is one.
normalize_type
A Rust type of an instance in the form both sides write: without spaces and the paths of leanfran ((rt::Nat, String) and (leanfran::Nat,String) are (Nat,String)).
parse_exported
The arguments of an exported attribute.
parse_model_args
Parses the arguments of #[leanfran::model(..)].
path_string
scan_file
Scans the parsed file ast (at file, relative to the crate root, in module module).
signature
The signature of a function (a method of an impl block with the generics outer), or an error for the signatures #[model] does not support.
trait_unit
The unit name of a trait method: crate::a::<Item as Trait>::f.
type_name
The last identifier of a type path (crate::inv::Item<T> → Item).
type_params
The type parameters of generics (the impl block’s, then the function’s), with the bounds of their where clauses.
type_text
The text of a type without spaces: Vec<u32>, (u32,String).