Struct leak_playground_std::marker::Unleak

source ·
#[repr(transparent)]
pub struct Unleak<'a, T: ?Sized> { _unforget: PhantomStaticUnforget, _anchor: PhantomData<fn(_: &'a ())>, inner: T, }
Expand description

A transparent wrapper to make your types !Forget

Fields§

§_unforget: PhantomStaticUnforget§_anchor: PhantomData<fn(_: &'a ())>

Inner value must be able to outlive this lifetime to be able to be forgotten. Of course it is contravariant, since expanding it may only disable the Forget implementation.

§inner: T

Implementations§

source§

impl<T> Unforget<'static, T>

source

pub const fn new(inner: T) -> Self

source§

impl<'a, T> Unforget<'a, T>

source

pub fn with_lifetime(inner: T) -> Self

source

pub fn into_inner(slot: Self) -> T

Get inner value.

Trait Implementations§

source§

impl<'a, T: Clone + ?Sized> Clone for Unforget<'a, T>

source§

fn clone(&self) -> Unforget<'a, T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: ?Sized + Debug> Debug for Unforget<'_, T>

source§

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

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

impl<'a, T: Default + ?Sized> Default for Unforget<'a, T>

source§

fn default() -> Unforget<'a, T>

Returns the “default value” for a type. Read more
source§

impl<T: ?Sized> Deref for Unforget<'_, T>

§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<T: ?Sized> DerefMut for Unforget<'_, T>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<T> Future for Unforget<'_, T>
where T: Future + ?Sized,

§

type Output = <T as Future>::Output

The type of value produced on completion.
source§

fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>

Attempt to resolve the future to a final value, registering the current task for wakeup if the value is not yet available. Read more
source§

impl<'a, T: Hash + ?Sized> Hash for Unforget<'a, T>

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
source§

impl<'a, T: Ord + ?Sized> Ord for Unforget<'a, T>

source§

fn cmp(&self, other: &Unforget<'a, T>) -> Ordering

This method returns an Ordering between self and other. Read more
source§

impl<'a, T: PartialEq + ?Sized> PartialEq for Unforget<'a, T>

source§

fn eq(&self, other: &Unforget<'a, T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, T: PartialOrd + ?Sized> PartialOrd for Unforget<'a, T>

source§

fn partial_cmp(&self, other: &Unforget<'a, T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<'a, T: Copy + ?Sized> Copy for Unforget<'a, T>

source§

impl<'a, T: Eq + ?Sized> Eq for Unforget<'a, T>

source§

impl<'a, T: ?Sized + 'a> Forget for Unforget<'a, T>

source§

impl<'a, T: ?Sized> StructuralPartialEq for Unforget<'a, T>

Auto Trait Implementations§

§

impl<'a, T> Freeze for Unforget<'a, T>
where T: Freeze + ?Sized,

§

impl<'a, T> RefUnwindSafe for Unforget<'a, T>
where T: RefUnwindSafe + ?Sized,

§

impl<'a, T> Send for Unforget<'a, T>
where T: Send + ?Sized,

§

impl<'a, T> Sync for Unforget<'a, T>
where T: Sync + ?Sized,

§

impl<'a, T> Unpin for Unforget<'a, T>
where T: Unpin + ?Sized,

§

impl<'a, T> UnwindSafe for Unforget<'a, T>
where T: UnwindSafe + ?Sized,

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> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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<F> IntoFuture for F
where F: Future,

§

type Output = <F as Future>::Output

The output that the future will produce on completion.
§

type IntoFuture = F

Which kind of future are we turning this into?
source§

fn into_future(self) -> <F as IntoFuture>::IntoFuture

Creates a future from a value. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.