# actix_web::middleware::session::SessionImpl - Rust
API documentation for the Rust `SessionImpl` trait in crate `actix_web`.
Keywords: rust, rustlang, rust-lang, SessionImpl

# [−] [src] Trait actix_web::middleware::session::SessionImpl

    pub trait SessionImpl: 'static {
        fn get(&self, key: &str) -> Option<&str>;
        fn set(&mut self, key: &str, value: String);
        fn remove(&mut self, key: &str);
        fn clear(&mut self);
        fn write(&self, resp: HttpResponse) -> Result<Response>;
    }

A simple key-value storage interface that is internally used by `Session`.

## Required Methods

### `fn get(&self, key: &str) -> Option<&str>`

Get session value by key

### `fn set(&mut self, key: &str, value: String)`

Set session value

### `fn remove(&mut self, key: &str)`

Remove specific key from session

### `fn clear(&mut self)`

Remove all values from session

### `fn write(&self, resp: HttpResponse) -> Result<Response>`

Write session to storage backend.

## Implementors

###

`impl SessionImpl for CookieSession`

[src]

####

`fn get(&self, key: &str) -> Option<&str>`

[src]

####

`fn set(&mut self, key: &str, value: String)`

[src]

####

`fn remove(&mut self, key: &str)`

[src]

####

`fn clear(&mut self)`

[src]

####

`fn write(&self, resp: HttpResponse) -> Result<Response>`

[src]

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