pub struct Aliasable<T> { /* private fields */ }
Expand description

An unboxed aliasable value.

Implementations

Create a new Aliasable that stores val.

Get a shared reference to the value inside the Aliasable.

This method takes Pin<&Self> instead of &self to enforce that all parent containers are !Unpin, and thus won’t be annotated with noalias.

This crate intentionally does not provide a method to get an &mut T, because the value may be shared. To obtain an &mut T you should use an interior mutable container such as a mutex or UnsafeCell.

Get a shared reference to the value inside the Aliasable with an extended lifetime.

Safety

The reference must not be held for longer than the Aliasable exists.

Consume the Aliasable, returning its inner value.

If get has already been called and the type is now pinned, obtaining the owned Aliasable<T> required to call this function requires breaking the pinning guarantee (as the Aliasable<T> is moved). However, this is sound as long as the Aliasable<T> isn’t actually aliased at that point in time.

Trait Implementations

Formats the value using the given formatter. Read more

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.