Skip to content

Commit

Permalink
Update docs on TaskData
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Aug 22, 2016
1 parent 69c30ef commit 308a7fd
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions TUTORIAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -1026,21 +1026,13 @@ from the signature of [`poll`] we also see that it has mutable access to
this task. The [`Task`] API leverages these facts and allows you to store
data inside a `Task`.

Data is stored inside a `Task` with [`insert`] which returns a [`TaskData`]
Data associated with a `Task` with [`TaskData::new`] to return a [`TaskData`]
handle. This handle can then be cloned regardless of the underlying data. To
access the data at a later time you can use the [`get`] or [`get_mut`] methods.
access the data at a later time you can use the [`with`] methods.

[`insert`]: http://alexcrichton.com/futures-rs/futures/struct.Task.html#method.insert
[`TaskData`]: http://alexcrichton.com/futures-rs/futures/struct.TaskData.html
[`get`]: http://alexcrichton.com/futures-rs/futures/struct.Task.html#method.get
[`get_mut`]: http://alexcrichton.com/futures-rs/futures/struct.Task.html#method.get_mut

A [`TaskData`] can also be created with the [`store`] future which will resolve
to a handle to the data being stored. Currently there is no combinator for
accessing data from a task and it's primarily used in manual implementations of
[`Future`], but this may change soon!

[`store`]: http://alexcrichton.com/futures-rs/futures/fn.store.html
[`TaskData`]: http://alexcrichton.com/futures-rs/futures/task/struct.TaskData.html
[`TaskData::new`]: http://alexcrichton.com/futures-rs/futures/task/struct.TaskData.html#method.new
[`with`]: http://alexcrichton.com/futures-rs/futures/task/struct.TaskData.html#method.with

---

Expand Down

0 comments on commit 308a7fd

Please sign in to comment.