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>

source

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 borrows. 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> Debug for TokenMut<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> IsTokenMut<'a> for TokenMut<'a>

source§

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,

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,

Borrows from a small, fixed, number of multiple Ptr Read more
source§

fn multi_dynamic<'r>(self) -> MultiDynamic<'r>
where 'a: 'r,

Borrows from an unknown number of Ptr with dynamic runtime checking Read more
source§

impl<'o, 'i: 'o, 'j: 'o> IsTokenMut<'o> for &'i mut TokenMut<'j>

source§

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,

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,

Borrows from a small, fixed, number of multiple Ptr Read more
source§

fn multi_dynamic<'r>(self) -> MultiDynamic<'r>
where 'a: 'r,

Borrows from an unknown number of Ptr with dynamic runtime checking Read more
source§

impl<'a> IsTokenRef<'a> for TokenMut<'a>

source§

fn token_ref(self) -> TokenRef<'a>

Obtains a new ZST token from something that might be a real object.
source§

impl<'o, 'i: 'o, 'j: 'o> IsTokenRef<'o> for &'i TokenMut<'j>

source§

fn token_ref(self) -> TokenRef<'a>

Obtains a new ZST token from something that might be a real object.
source§

impl<'o, 'i: 'o, 'j: 'o> IsTokenRef<'o> for &'i mut TokenMut<'j>

source§

fn token_ref(self) -> TokenRef<'a>

Obtains a new ZST token from something that might be a real object.

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.