Struct symbol_map::indexing::Ref
[−]
[src]
pub struct Ref<T> { // some fields omitted }
Wrapper for a raw pointer which lets us treat it like a reference.
You are strongly discouraged from exposing this type directly in your data structures. This type is essentially a giant footgun. In particular:
No safety checks or lifetimes protect this reference, so a
Ref<T>
may be invalidated without warning. (You may use aRef<T>
safely by ensuring that the references passed toRef<T>::new()
will never be dropped before the wrappers. A good example of when you'd be able to do this is in in a struct that hasRef<T>
references into a data structure that it also owns.)The impls for
Debug
,Eq
,Hash
,Ord
,PartialEq
, andPartialOrd
all dereference the raw pointer that this structure wraps. As a result, aRef<T>
must be removed from any data structures that make use of any of those interfaces before it is invalidated.Ref<T>
wraps a value of type*const T
, which is not usuallySend
orSync
. This restriction is overridden for aRef<T>
wrapper so that data structures which encapsulate it may themselves beSend
orSync
. This makes it the responsibility of data structures using such wrappers to satisfy the contracts of those types.
Trait Implementations
impl<T> Send for Ref<T> where T: Send
[src]
impl<T> Sync for Ref<T> where T: Sync
[src]
impl<T> Clone for Ref<T>
[src]
fn clone(&self) -> Self
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<T> Copy for Ref<T>
[src]
impl<T> Pointer for Ref<T>
[src]
impl<T> Debug for Ref<T> where T: Debug
[src]
impl<T> Eq for Ref<T> where T: Eq
[src]
impl<T> Hash for Ref<T> where T: Hash
[src]
fn hash<H>(&self, h: &mut H) where H: Hasher
Feeds this value into the state given, updating the hasher as necessary.
fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0
Feeds a slice of this type into the state provided.
impl<T> Ord for Ref<T> where T: Ord
[src]
fn cmp(&self, other: &Self) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl<T> PartialEq for Ref<T> where T: PartialEq
[src]
fn eq(&self, other: &Self) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl<T> PartialOrd for Ref<T> where T: PartialOrd
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more