# Function futures::task::current [−] [src]

    pub fn current() -> Task

Returns a handle to the current task to call `notify` at a later date.

The returned handle implements the `Send` and `'static` bounds and may also be cheaply cloned. This is useful for squirreling away the handle into a location which is then later signaled that a future can make progress.

Implementations of the `Future` trait typically use this function if they would otherwise perform a blocking operation. When something isn't ready yet, this `current` function is called to acquire a handle to the current task, and then the future arranges it such that when the blocking operation otherwise finishes (perhaps in the background) it will `notify` the returned handle.

It's sometimes necessary to pass extra information to the task when unparking it, so that the task knows something about why it was woken. See the `FutureQueue` documentation for details on how to do this.

# Panics

This function will panic if a task is not currently being executed. That is, this method can be dangerous to call outside of an implementation of `poll`.

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)