Skip to main content

key_for_oid

Function key_for_oid 

Source
pub fn key_for_oid(oid: &[u8]) -> i64
Expand description

The key an oid maps into: its first eight bytes as a big-endian unsigned integer, with the top bit flipped so that unsigned order becomes signed order.

The flip is the whole point — stree compares i64, and without it every oid starting 0x80 or higher sorts before every oid starting 0x00..0x7f. See the module docs.

Oids shorter than eight bytes cannot occur (sha1 is 20), but the function is total anyway: it zero-pads rather than panicking.