Struct libintern::Intern [−][src]
pub struct Intern<'a, T: 'a>(_);
Expand description
A reference to an interned item.
The main advantage of this type over just
an immutable reference is that its pointer is guaranteed to be unique
within a single Interner
. Therefore comparisons
are very cheap.
Note about hashing
This wrapper implements PartialEq
by comparing its inner pointer.
In order to keep consistency, the Hash
trait is also implemented
by hashing the pointer, NOT the inner value. Therefore hashes
of the Intern<T>
type are different than hashes of the T
.
Implementations
Trait Implementations
To keep consistency with PartialEq
, we hash the pointer, not the value
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl<'a, T> RefUnwindSafe for Intern<'a, T> where
T: RefUnwindSafe,
impl<'a, T> UnwindSafe for Intern<'a, T> where
T: RefUnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more