Contravariant lifetimes can model garbage collected handles in Rust more accurately than covariant ones. Unlike normal references where longer lifetimes can substitute for shorter ones, contravariant references reverse this relationship, allowing handles with shorter lifetimes to be stored in places expecting longer lifetimes.

21m read timeFrom trynova.dev
Post cover image
Table of contents
Working with a garbage collected heapContrary thinkingOn the double? On the contrary!Thinking bigger

Sort: