mirror of
https://github.com/actix/actix-web.git
synced 2025-01-02 21:38:46 +00:00
Update doc comment for HttpRequest::app_data
(#1265)
* 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 <huyuumi.dev@gmail.com> Co-authored-by: Yuki Okushi <huyuumi.dev@gmail.com>
This commit is contained in:
parent
abb462ef85
commit
7c974ee668
1 changed files with 8 additions and 2 deletions
|
@ -206,8 +206,14 @@ impl HttpRequest {
|
||||||
&self.0.config
|
&self.0.config
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get an application data stored with `App::extension()` method during
|
/// Get an application data object stored with `App::data` or `App::app_data`
|
||||||
/// application configuration.
|
/// 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> {
|
pub fn app_data<T: 'static>(&self) -> Option<&T> {
|
||||||
if let Some(st) = self.0.app_data.get::<T>() {
|
if let Some(st) = self.0.app_data.get::<T>() {
|
||||||
Some(&st)
|
Some(&st)
|
||||||
|
|
Loading…
Reference in a new issue