# Function futures::executor::with_notify [−] [src]

    pub fn with_notify<F, T, R>(notify: &T, id: usize, f: F) -> R where
        F: FnOnce() -> R,
        T: Clone + Into<NotifyHandle>,

Sets the `NotifyHandle` of the current task for the duration of the provided closure.

This function takes a type that can be converted into a notify handle, `notify` and `id`, and a closure `f`. The closure `f` will be executed such that calls to `task::current()` will store a reference to the notify handle provided, not the one previously in the environment.

Note that calls to `task::current()` in the closure provided will not be equivalent to `task::current()` before this method is called. The two tasks returned will notify different handles, and the task handles pulled out during the duration of this closure will not notify the previous task. It's recommended that you call `task::current()` in some capacity before calling this function to ensure that calls to `task::current()` inside of this closure can transitively wake up the outer task.

# Panics

This function will panic if it is called outside the context of a future's task. This is only valid to call once you've already entered a future via `Spawn::poll_*` functions.

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