Skip to main content

alias

Function alias 

Source
pub fn alias(prefix: &str, table: &str, depth: usize) -> String
Expand description

<prefix>_<table>_<depth>__, clamped to what every shipped engine stores whole.

§A long name is CLAMPED, and the clamp cannot re-collide two names

Past [ALIAS_CEILING] the prefix and the depth are the parts that must survive, so the TABLE is what gives way — and a plain truncation is exactly the silent re-collision the ceiling exists to avoid, since two tables sharing a long leading run would cut to one string. So a clamped name keeps what fits and ends in a digest of the WHOLE name, which differs wherever the names do.

§The budget is the PREFIX’s to spend, which is why a declared one is bounded

Every byte the prefix takes is a byte the table loses before the clamp starts cutting, so a long enough prefix would leave nothing for the name to be recognisable by — and, further out, nothing for the digest either, which is subtraction below zero rather than a bad name. refused is what holds a declared prefix above that line, and it is checked where the declaration is read rather than here: this function is the mint, and a mint that answered a refusal would have two jobs.