Module core::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;
}
Run

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;
}
Run

Re-exports

This documentation is an old archive. Please see https://rust.docs.kernel.org instead.