Trait refid::Id [−][src]
Expand description
Type that can be compared in regard to identity (e.g. through address comparison) instead of
equality (as done by PartialEq
)
Caveats / Notes
- Two references (passed to
same
as references to the respective reference) are considered the same if they point to the same memory range. However, empty memory ranges (e.g. in case of empty slices or zero-sized types) are always considered identical, even if their base address is different. - Two
Rc
s (or twoArc
s) are considered the same if they share the same reference counter (i.e. if they are clones). This also holds if their inner type is a zero-sized type. - Working with trait objects may cause surprising behavior due to current implementation of
Id
for references and Rust’s pointer comparison rules.
Required methods
Implementations on Foreign Types
References are identical if their pointer representation is equal or if they both refer to a zero-sized value
Rc
s are identical if they share the same reference counter
Arc
s are identical if they share the same reference counter