Struct futures_util::future::Shared
source · [−]pub struct Shared<Fut: Future> { /* private fields */ }
Expand description
Future for the shared
method.
Implementations
sourceimpl<Fut> Shared<Fut> where
Fut: Future,
Fut::Output: Clone,
impl<Fut> Shared<Fut> where
Fut: Future,
Fut::Output: Clone,
sourcepub fn downgrade(&self) -> Option<WeakShared<Fut>>
pub fn downgrade(&self) -> Option<WeakShared<Fut>>
Creates a new WeakShared
for this Shared
.
Returns None
if it has already been polled to completion.
sourcepub fn strong_count(&self) -> Option<usize>
pub fn strong_count(&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.
sourcepub fn weak_count(&self) -> Option<usize>
pub fn weak_count(&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.
Trait Implementations
sourceimpl<Fut> FusedFuture for Shared<Fut> where
Fut: Future,
Fut::Output: Clone,
impl<Fut> FusedFuture for Shared<Fut> where
Fut: Future,
Fut::Output: Clone,
sourcefn is_terminated(&self) -> bool
fn is_terminated(&self) -> bool
Returns true
if the underlying future should no longer be polled.
impl<Fut: Future> Unpin for Shared<Fut>
Auto Trait Implementations
impl<Fut> !RefUnwindSafe for Shared<Fut>
impl<Fut> Send for Shared<Fut> where
Fut: Send,
<Fut as Future>::Output: Send + Sync,
impl<Fut> Sync for Shared<Fut> where
Fut: Send,
<Fut as Future>::Output: Send + Sync,
impl<Fut> !UnwindSafe for Shared<Fut>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<F> IntoFuture for F where
F: Future,
impl<F> IntoFuture for F where
F: Future,
type Output = <F as Future>::Output
type Output = <F as Future>::Output
into_future
)The output that the future will produce on completion.
type IntoFuture = F
type IntoFuture = F
into_future
)Which kind of future are we turning this into?
sourcefn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
into_future
)Creates a future from a value.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more