Skip to content

Commit

Permalink
Update doc comment for HttpRequest::app_data (actix#1265)
Browse files Browse the repository at this point in the history
* update doc comment for `HttpRequest::app_data`

* add `no_run` to doc comment

* add `ignore` to doc comment

* Update src/request.rs

Co-Authored-By: Yuki Okushi <[email protected]>

Co-authored-by: Yuki Okushi <[email protected]>
  • Loading branch information
kardeiz and JohnTitor committed Jan 10, 2020
1 parent abb462e commit 7c974ee
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,14 @@ impl HttpRequest {
&self.0.config
}

/// Get an application data stored with `App::extension()` method during
/// application configuration.
/// Get an application data object stored with `App::data` or `App::app_data`
/// methods during application configuration.
///
/// If `App::data` was used to store object, use `Data<T>`:
///
/// ```rust,ignore
/// let opt_t = req.app_data::<Data<T>>();
/// ```
pub fn app_data<T: 'static>(&self) -> Option<&T> {
if let Some(st) = self.0.app_data.get::<T>() {
Some(&st)
Expand Down

0 comments on commit 7c974ee

Please sign in to comment.