Struct manually_boxed::TokenMut
source · pub struct TokenMut<'a>(/* private fields */);
Expand description
&mut
NoAliasSingleton
, but zero-sized
See TokenRef
Implementations§
source§impl<'a> TokenMut<'a>
impl<'a> TokenMut<'a>
sourcepub unsafe fn new_unchecked() -> Self
pub unsafe fn new_unchecked() -> Self
Allows borrowing on the caller’s recognisance
This will let you call
Ptr::borrow()
/borrow_mut()
multiple times, retaining and using all the resulting references.
For another approach,
see Ptr::as_ptr()
.
§SAFETY
The calls to borrow[_mut]
that this enables must not violate
Rust’s rules. Checking that is up to you.
So, all of the Ptr
you borrow_mut
must be distinct,
and they must be distinct from your borrow
s.
Violating this rule is instant undefined behaviour,
even if you never read or write the resulting reference(s).
Also, it is up to you to make sure you don’t free the data to soon.
Trait Implementations§
source§impl<'a> IsTokenMut<'a> for TokenMut<'a>
impl<'a> IsTokenMut<'a> for TokenMut<'a>
source§fn token_mut<'r>(self) -> TokenMut<'r>where
'a: 'r,
fn token_mut<'r>(self) -> TokenMut<'r>where
'a: 'r,
Obtains a new ZST token from something that might be a real object.
source§fn as_mut<'r, 's: 'r>(&'s mut self) -> TokenMut<'r>where
'a: 'r,
fn as_mut<'r, 's: 'r>(&'s mut self) -> TokenMut<'r>where
'a: 'r,
Obtains a new ZST token from a borrow that might be of a real object.
source§fn multi_static<'r>(self) -> MultiStatic<'r, ()>where
'a: 'r,
fn multi_static<'r>(self) -> MultiStatic<'r, ()>where
'a: 'r,
Borrows from a small, fixed, number of multiple
Ptr
Read moresource§fn multi_dynamic<'r>(self) -> MultiDynamic<'r>where
'a: 'r,
fn multi_dynamic<'r>(self) -> MultiDynamic<'r>where
'a: 'r,
Borrows from an unknown number of
Ptr
with dynamic runtime checking Read moresource§impl<'o, 'i: 'o, 'j: 'o> IsTokenMut<'o> for &'i mut TokenMut<'j>
impl<'o, 'i: 'o, 'j: 'o> IsTokenMut<'o> for &'i mut TokenMut<'j>
source§fn token_mut<'r>(self) -> TokenMut<'r>where
'a: 'r,
fn token_mut<'r>(self) -> TokenMut<'r>where
'a: 'r,
Obtains a new ZST token from something that might be a real object.
source§fn as_mut<'r, 's: 'r>(&'s mut self) -> TokenMut<'r>where
'a: 'r,
fn as_mut<'r, 's: 'r>(&'s mut self) -> TokenMut<'r>where
'a: 'r,
Obtains a new ZST token from a borrow that might be of a real object.
source§fn multi_static<'r>(self) -> MultiStatic<'r, ()>where
'a: 'r,
fn multi_static<'r>(self) -> MultiStatic<'r, ()>where
'a: 'r,
Borrows from a small, fixed, number of multiple
Ptr
Read moresource§fn multi_dynamic<'r>(self) -> MultiDynamic<'r>where
'a: 'r,
fn multi_dynamic<'r>(self) -> MultiDynamic<'r>where
'a: 'r,
Borrows from an unknown number of
Ptr
with dynamic runtime checking Read moresource§impl<'a> IsTokenRef<'a> for TokenMut<'a>
impl<'a> IsTokenRef<'a> for TokenMut<'a>
source§impl<'o, 'i: 'o, 'j: 'o> IsTokenRef<'o> for &'i TokenMut<'j>
impl<'o, 'i: 'o, 'j: 'o> IsTokenRef<'o> for &'i TokenMut<'j>
Auto Trait Implementations§
impl<'a> Freeze for TokenMut<'a>
impl<'a> RefUnwindSafe for TokenMut<'a>
impl<'a> Send for TokenMut<'a>
impl<'a> Sync for TokenMut<'a>
impl<'a> Unpin for TokenMut<'a>
impl<'a> !UnwindSafe for TokenMut<'a>
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