pub fn id_from_object(obj: &Object, bytes: &[u8]) -> HashExpand description
Content id of an already-decoded object whose canonical encoding is
bytes. A merkelized type (Tree / ChunkedBlob) is addressed by its
BMT root, computed from the decoded struct; every other type is BLAKE3 of
bytes, reusing the caller’s buffer (no re-serialize — bytes may be up
to ~1 GiB).
This is the bytes-reusing twin of Object::id; both share the same
merkle_id dispatch, so a merkelized type keys identically whether
addressed from the decoded struct (native store) or from bytes the caller
already holds (the pack reader, the mkit-wasm encoder).
§Precondition
For a byte-hashed (non-merkle) type, bytes MUST be obj’s canonical
serialization: the id is BLAKE3(bytes), taken on trust with no re-encode.
Passing a buffer that is not obj’s encoding silently mis-addresses it.
Merkle types ignore bytes entirely (addressed from the struct).