pub struct HostTreePointer<T> { /* private fields */ }
Expand description
A pointer to an object that is safe to dereference from any thread, if the Host lock for the specified host is held.
Implementations§
source§impl<T> HostTreePointer<T>
impl<T> HostTreePointer<T>
sourcepub fn new_for_host(host_id: HostId, ptr: *mut T) -> Self
pub fn new_for_host(host_id: HostId, ptr: *mut T) -> Self
Create a pointer that may only be accessed when the host with id
host_id
is active.
sourcepub fn new(ptr: *mut T) -> Self
pub fn new(ptr: *mut T) -> Self
Create a pointer that may only be accessed when the current host is active.
sourcepub unsafe fn ptr(&self) -> *mut T
pub unsafe fn ptr(&self) -> *mut T
Get the pointer.
Panics if the configured host is not active.
§Safety
Pointer must only be dereferenced while the configures Host is still active, in addition to the normal safety requirements for dereferencing a pointer.
sourcepub unsafe fn ptr_with_host(&self, host: &Host) -> *mut T
pub unsafe fn ptr_with_host(&self, host: &Host) -> *mut T
Get the pointer.
Panics if host
is not the one associated with self
.
§Safety
Pointer must only be dereferenced while the configures Host is still active, in addition to the normal safety requirements for dereferencing a pointer.
sourcepub unsafe fn ptr_unchecked(&self) -> *mut T
pub unsafe fn ptr_unchecked(&self) -> *mut T
Get the pointer without checking the active host.
§Safety
Pointer must only be dereferenced while the configures Host is still active, in addition to the normal safety requirements for dereferencing a pointer.
Trait Implementations§
source§impl<T> Clone for HostTreePointer<T>
impl<T> Clone for HostTreePointer<T>
source§impl<T: Debug> Debug for HostTreePointer<T>
impl<T: Debug> Debug for HostTreePointer<T>
impl<T> Copy for HostTreePointer<T>
impl<T> Send for HostTreePointer<T>
impl<T> Sync for HostTreePointer<T>
Auto Trait Implementations§
impl<T> Freeze for HostTreePointer<T>
impl<T> RefUnwindSafe for HostTreePointer<T>where
T: RefUnwindSafe,
impl<T> Unpin for HostTreePointer<T>
impl<T> UnwindSafe for HostTreePointer<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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more