Skip to main content

key_base

Function key_base 

Source
pub const fn key_base(module: &str, declaration: u32) -> u64
Expand description

The high half of every key one declaration’s items get.

A derive cannot see other expansions, so it cannot hand out keys from a shared counter: it hashes the declaration it was given instead. It cannot see a module path either, which is why the module is mixed in heremodule_path!() is available to the generated code as a compile-time string, so two byte-identical declarations in different modules end up with different keys rather than colliding.

declaration is a hash the derive computed over the item’s own tokens.