Struct Shared

struct Shared<Fut: Future> { ... }

Future for the shared method.

Implementations

impl<Fut> Shared<Fut>

fn peek(self: &Self) -> Option<&<Fut as >::Output>

Returns Some containing a reference to this Shared's output if it has already been computed by a clone or None if it hasn't been computed yet or this Shared already returned its output from poll.

fn downgrade(self: &Self) -> Option<WeakShared<Fut>>

Creates a new WeakShared for this Shared.

Returns None if it has already been polled to completion.

fn strong_count(self: &Self) -> Option<usize>

Gets the number of strong pointers to this allocation.

Returns None if it has already been polled to completion.

Safety

This method by itself is safe, but using it correctly requires extra care. Another thread can change the strong count at any time, including potentially between calling this method and acting on the result.

fn weak_count(self: &Self) -> Option<usize>

Gets the number of weak pointers to this allocation.

Returns None if it has already been polled to completion.

Safety

This method by itself is safe, but using it correctly requires extra care. Another thread can change the weak count at any time, including potentially between calling this method and acting on the result.

fn ptr_hash<H: Hasher>(self: &Self, state: &mut H)

Hashes the internal state of this Shared in a way that's compatible with ptr_eq.

fn ptr_eq(self: &Self, rhs: &Self) -> bool

Returns true if the two Shareds point to the same future (in a vein similar to Arc::ptr_eq).

Returns false if either Shared has terminated.

impl<F> IntoFuture for Shared<Fut>

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

impl<F, T, E> TryFuture for Shared<Fut>

fn try_poll(self: Pin<&mut F>, cx: &mut Context<'_>) -> Poll<<F as Future>::Output>

impl<Fut> Clone for Shared<Fut>

fn clone(self: &Self) -> Self

impl<Fut> Drop for Shared<Fut>

fn drop(self: &mut Self)

impl<Fut> Freeze for Shared<Fut>

impl<Fut> FusedFuture for Shared<Fut>

fn is_terminated(self: &Self) -> bool

impl<Fut> Future for Shared<Fut>

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

impl<Fut> RefUnwindSafe for Shared<Fut>

impl<Fut> Send for Shared<Fut>

impl<Fut> Sync for Shared<Fut>

impl<Fut> TryFutureExt for Shared<Fut>

impl<Fut> Unpin for Shared<Fut>

impl<Fut> UnsafeUnpin for Shared<Fut>

impl<Fut> UnwindSafe for Shared<Fut>

impl<Fut: Future> Debug for Shared<Fut>

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

impl<T> Any for Shared<Fut>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Shared<Fut>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Shared<Fut>

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

impl<T> CloneToUninit for Shared<Fut>

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for Shared<Fut>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> FutureExt for Shared<Fut>

impl<T> ToOwned for Shared<Fut>

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for Shared<Fut>

fn into(self: Self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom for Shared<Fut>

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

impl<T, U> TryInto for Shared<Fut>

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