pub struct RRef<T> { /* private fields */ }Expand description
A region-owned reference to heap-allocated data.
RRef<T> allows tasks to hold references to data allocated in a region’s
heap. The reference is valid as long as the owning region is open.
§Send/Sync
RRef<T> is Send when T: Send and Sync when T: Sync. This allows
RRefs to be safely passed to worker threads. The bounds are automatically
provided through PhantomData<T> - no unsafe code required.
§Cloning
RRef is Clone + Copy because it contains only indices, not the actual
data. Multiple RRefs can point to the same heap allocation.
Implementations§
Source§impl<T> RRef<T>
impl<T> RRef<T>
Sourcepub fn validate_witness(
&self,
witness: &RRefAccessWitness,
) -> Result<(), RRefError>
pub fn validate_witness( &self, witness: &RRefAccessWitness, ) -> Result<(), RRefError>
Validates that a witness matches this RRef’s region.
Returns Err(WrongRegion) if the witness was obtained from a different
region than the one this RRef belongs to.
Trait Implementations§
impl<T> Copy for RRef<T>
impl<T> Eq for RRef<T>
Auto Trait Implementations§
impl<T> Freeze for RRef<T>
impl<T> RefUnwindSafe for RRef<T>where
T: RefUnwindSafe,
impl<T> Send for RRef<T>where
T: Send,
impl<T> Sync for RRef<T>where
T: Sync,
impl<T> Unpin for RRef<T>where
T: Unpin,
impl<T> UnsafeUnpin for RRef<T>
impl<T> UnwindSafe for RRef<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).