Struct kvarn_utils::SuperUnsafePointer
source · [−]#[repr(transparent)]pub struct SuperUnsafePointer<T> { /* private fields */ }
Expand description
Should only be used from within Kvarn! A super-unsafe pointer. Must be used with great care.
Safety
The safety of this struct requires you to
- make sure the lifetime of the
reference
lives longer than all references returned bySelf::get
andSelf::get_mut
. - make sure no other references exist.
You can use
Self::new_mut
to garantuee this.
This type implements Send + Sync
to allow it to cross async
boundarys.
This type is used in the move ||
part of extensions.
Implementations
sourceimpl<T> SuperUnsafePointer<T>
impl<T> SuperUnsafePointer<T>
sourcepub fn new_mut(reference: &mut T) -> Self
pub fn new_mut(reference: &mut T) -> Self
Creates a new pointer from a mutable reference.
Safety
Read the docs of this struct for safety requirements.
The compiler guarantees exclusive mutable access.
sourcepub unsafe fn new(reference: &T) -> Self
pub unsafe fn new(reference: &T) -> Self
Creates a new pointer from a reference.
Safety
Read the docs of this struct for safety requirements.
Trait Implementations
sourceimpl<T> Clone for SuperUnsafePointer<T>
impl<T> Clone for SuperUnsafePointer<T>
sourceimpl<T> Debug for SuperUnsafePointer<T>
impl<T> Debug for SuperUnsafePointer<T>
sourceimpl<T> PartialEq<SuperUnsafePointer<T>> for SuperUnsafePointer<T>
impl<T> PartialEq<SuperUnsafePointer<T>> for SuperUnsafePointer<T>
impl<T> Eq for SuperUnsafePointer<T>
impl<T: Send> Send for SuperUnsafePointer<T>
impl<T: Sync> Sync for SuperUnsafePointer<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for SuperUnsafePointer<T> where
T: RefUnwindSafe,
impl<T> Unpin for SuperUnsafePointer<T>
impl<T> UnwindSafe for SuperUnsafePointer<T> where
T: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more