Module creusot_contracts::std::primitive

1.43.0 · source ·
Expand description

This module reexports the primitive types to allow usage that is not possibly shadowed by other declared types.

This is normally only useful in macro generated code.

An example of this is when generating a new struct and an impl for it:

pub struct bool;

impl QueryId for bool {
    const SOME_PROPERTY: bool = true;
}

Note that the SOME_PROPERTY associated constant would not compile, as its type bool refers to the struct, rather than to the primitive bool type.

A correct implementation could look like:

pub struct bool;

impl QueryId for bool {
    const SOME_PROPERTY: ::core::primitive::bool = true;
}

We also used ::core instead of core, because core can be shadowed, too. Paths, starting with ::, are searched in the extern prelude since Edition 2018.

Re-exports§