pub struct RcuPtrRef<'a, T> { /* private fields */ }Expand description
A pointer to an object managed by the RCU state machine.
This pointer is valid for reading until the RcuReadScope is dropped.
Implementations§
Source§impl<'a, T> RcuPtrRef<'a, T>
impl<'a, T> RcuPtrRef<'a, T>
Sourcepub unsafe fn new(_scope: &'a RcuReadScope, ptr: *const T) -> Self
pub unsafe fn new(_scope: &'a RcuReadScope, ptr: *const T) -> Self
Create a new RcuPtrRef from a pointer and a scope.
§Safety
The pointer must be valid for reading until the RcuReadScope is dropped.
Sourcepub fn as_ref(&self) -> Option<&'a T>
pub fn as_ref(&self) -> Option<&'a T>
Get a reference to the object.
Returns None if the pointer is null.
Sourcepub fn as_mut_ptr(&self) -> *mut T
pub fn as_mut_ptr(&self) -> *mut T
Get the raw mutable pointer to the object.
Sourcepub unsafe fn add_byte_offset<U>(&self, offset: usize) -> RcuPtrRef<'a, U>
pub unsafe fn add_byte_offset<U>(&self, offset: usize) -> RcuPtrRef<'a, U>
Adds a byte offset to the pointer.
§Safety
The caller must ensure that the offset is within the bounds of the object and points to a
valid object of type U.
Sourcepub unsafe fn sub_byte_offset<U>(&self, offset: usize) -> RcuPtrRef<'a, U>
pub unsafe fn sub_byte_offset<U>(&self, offset: usize) -> RcuPtrRef<'a, U>
Subtracts a byte offset from the pointer.
§Safety
The caller must ensure that the offset is within the bounds of the object and points to a
valid object of type U.
Trait Implementations§
Auto Trait Implementations§
impl<'a, T> Freeze for RcuPtrRef<'a, T>
impl<'a, T> RefUnwindSafe for RcuPtrRef<'a, T>where
T: RefUnwindSafe,
impl<'a, T> !Send for RcuPtrRef<'a, T>
impl<'a, T> !Sync for RcuPtrRef<'a, T>
impl<'a, T> Unpin for RcuPtrRef<'a, T>
impl<'a, T> UnwindSafe for RcuPtrRef<'a, T>where
T: RefUnwindSafe,
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