1.43.0[][src]Module std::primitive

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:

This example deliberately fails to compile
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

pub use bool;
pub use char;
pub use f32;
pub use f64;
pub use i128;
pub use i16;
pub use i32;
pub use i64;
pub use i8;
pub use isize;
pub use str;
pub use u128;
pub use u16;
pub use u32;
pub use u64;
pub use u8;
pub use usize;