# actix_web::Extensions - Rust
API documentation for the Rust `Extensions` struct in crate `actix_web`.
Keywords: rust, rustlang, rust-lang, Extensions

# Struct actix_web::Extensions [−] [src]

    pub struct Extensions { /* fields omitted */ }

A type map of request extensions.

## Methods

###

`impl Extensions`

[src]

####

`pub fn insert<T: 'static>(&mut self, val: T)`

[src]

Insert a type into this `Extensions`.

If a extension of this type already existed, it will be returned.

####

`pub fn get<T: 'static>(&self) -> Option<&T>`

[src]

Get a reference to a type previously inserted on this `Extensions`.

####

`pub fn get_mut<T: 'static>(&mut self) -> Option<&mut T>`

[src]

Get a mutable reference to a type previously inserted on this `Extensions`.

####

`pub fn remove<T: 'static>(&mut self) -> Option<T>`

[src]

Remove a type from this `Extensions`.

If a extension of this type existed, it will be returned.

####

`pub fn clear(&mut self)`

[src]

Clear the `Extensions` of all inserted extensions.

## Trait Implementations

###

`impl Debug for Extensions`

[src]

####

`fn fmt(&self, f: &mut Formatter) -> Result`

[src]

Formats the value using the given formatter. Read more

## Auto Trait Implementations

###

`impl !Send for Extensions`

###

`impl !Sync for Extensions`

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

Search multiple things at once by splitting your query with comma (e.g. `str,u8` or `String,struct:Vec,test`)