Skip to main content

serialize_dedup_shared

Function serialize_dedup_shared 

Source
pub fn serialize_dedup_shared<T>(f: impl FnOnce() -> T) -> T
Expand description

Runs f with a fresh shared-node deduplication scope for serialization. Any SharedNode serialized inside f will be tracked; the first occurrence emits the full subtree while later occurrences emit a {"$shared_ref": id} back-reference. The tracking state is restored when f returns or panics.