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

    pub fn with_unpark_event<F, R>(event: UnparkEvent, f: F) -> R where
        F: FnOnce() -> R,

Deprecated

: recommended to use `FuturesUnordered` instead

For the duration of the given callback, add an "unpark event" to be triggered when the task handle is used to unpark the task.

Unpark events are used to pass information about what event caused a task to be unparked. In some cases, tasks are waiting on a large number of possible events, and need precise information about the wakeup to avoid extraneous polling.

Every `Task` handle comes with a set of unpark events which will fire when `unpark` is called. When fired, these events insert an identifier into a concurrent set, which the task can read from to determine what events occurred.

This function immediately invokes the closure, `f`, but arranges things so that `task::park` will produce a `Task` handle that includes the given unpark event.

# 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`)