2022-03-06 00:25:11 +01:00
<!DOCTYPE html> < html lang = "en" > < head > < meta charset = "utf-8" > < meta name = "viewport" content = "width=device-width, initial-scale=1.0" > < meta name = "generator" content = "rustdoc" > < meta name = "description" content = "The interface to retrieve and save the current session data from/to the chosen storage backend." > < meta name = "keywords" content = "rust, rustlang, rust-lang, SessionStore" > < title > SessionStore in actix_session::storage - Rust< / title > < link rel = "preload" as = "font" type = "font/woff2" crossorigin href = "../../SourceSerif4-Regular.ttf.woff2" > < link rel = "preload" as = "font" type = "font/woff2" crossorigin href = "../../FiraSans-Regular.woff2" > < link rel = "preload" as = "font" type = "font/woff2" crossorigin href = "../../FiraSans-Medium.woff2" > < link rel = "preload" as = "font" type = "font/woff2" crossorigin href = "../../SourceCodePro-Regular.ttf.woff2" > < link rel = "preload" as = "font" type = "font/woff2" crossorigin href = "../../SourceSerif4-Bold.ttf.woff2" > < link rel = "preload" as = "font" type = "font/woff2" crossorigin href = "../../SourceCodePro-Semibold.ttf.woff2" > < link rel = "stylesheet" type = "text/css" href = "../../normalize.css" > < link rel = "stylesheet" type = "text/css" href = "../../rustdoc.css" id = "mainThemeStyle" > < link rel = "stylesheet" type = "text/css" href = "../../ayu.css" disabled > < link rel = "stylesheet" type = "text/css" href = "../../dark.css" disabled > < link rel = "stylesheet" type = "text/css" href = "../../light.css" id = "themeStyle" > < script id = "default-settings" > < / script > < script src = "../../storage.js" > < / script > < script src = "../../crates.js" > < / script > < script defer src = "../../main.js" > < / script >
< noscript > < link rel = "stylesheet" href = "../../noscript.css" > < / noscript > < link rel = "icon" href = "https://actix.rs/favicon.ico" > < / head > < body class = "rustdoc trait" > <!-- [if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif] --> < nav class = "mobile-topbar" > < button class = "sidebar-menu-toggle" > ☰ < / button > < a class = "sidebar-logo" href = "../../actix_session/index.html" > < div class = "logo-container" > < img src = "https://actix.rs/img/logo.png" alt = "logo" > < / div >
< / a > < h2 class = "location" > < / h2 >
< / nav >
< nav class = "sidebar" > < a class = "sidebar-logo" href = "../../actix_session/index.html" > < div class = "logo-container" >
< img src = "https://actix.rs/img/logo.png" alt = "logo" > < / div >
< / a > < h2 class = "location" > < a href = "#" > SessionStore< / a > < / h2 > < div class = "sidebar-elems" > < section > < div class = "block" > < h3 class = "sidebar-title" > < a href = "#required-methods" > Required Methods< / a > < / h3 > < ul > < li > < a href = "#tymethod.delete" > delete< / a > < / li > < li > < a href = "#tymethod.load" > load< / a > < / li > < li > < a href = "#tymethod.save" > save< / a > < / li > < li > < a href = "#tymethod.update" > update< / a > < / li > < / ul > < / div > < div class = "block" > < h3 class = "sidebar-title" > < a href = "#implementors" > Implementors< / a > < / h3 > < / div > < / section > < h2 class = "location" > < a href = "index.html" > In actix_session::storage< / a > < / h2 > < div id = "sidebar-vars" data-name = "SessionStore" data-ty = "trait" data-relpath = "" > < / div > < script defer src = "sidebar-items.js" > < / script > < / div > < / nav > < main > < div class = "width-limiter" > < div class = "sub-container" > < a class = "sub-logo-container" href = "../../actix_session/index.html" >
2022-05-18 11:58:19 +02:00
< img src = "https://actix.rs/img/logo.png" alt = "logo" > < / a > < nav class = "sub" > < form class = "search-form" > < div class = "search-container" > < span > < / span > < input class = "search-input" name = "search" autocomplete = "off" spellcheck = "false" placeholder = "Click or press ‘ S’ to search, ‘ ?’ for more options…" type = "search" > < button type = "button" id = "help-button" title = "help" > ?< / button > < div id = "settings-menu" tabindex = "-1" >
< a href = "../../settings.html" title = "settings" > < img width = "22" height = "22" alt = "Change settings" src = "../../wheel.svg" > < / a > < / div >
< / div > < / form > < / nav > < / div > < section id = "main-content" class = "content" > < div class = "main-heading" >
2022-03-15 17:29:58 +01:00
< h1 class = "fqn" > < span class = "in-band" > Trait < a href = "../index.html" > actix_session< / a > ::< wbr > < a href = "index.html" > storage< / a > ::< wbr > < a class = "trait" href = "#" > SessionStore< / a > < button id = "copy-path" onclick = "copy_path(this)" title = "Copy item path to clipboard" > < img src = "../../clipboard.svg" width = "19" height = "18" alt = "Copy item path" > < / button > < / span > < / h1 > < span class = "out-of-band" > < a class = "srclink" href = "../../src/actix_session/storage/interface.rs.html#18-41" > source< / a > · < a id = "toggle-all-docs" href = "javascript:void(0)" title = "collapse all docs" > [< span class = "inner" > − < / span > ]< / a > < / span > < / div > < div class = "docblock item-decl" > < pre class = "rust trait" > < code > pub trait SessionStore {
2022-03-06 00:25:11 +01:00
fn < a href = "#tymethod.load" class = "fnname" > load< / a > < 'life0, 'life1, 'async_trait> (< br > & 'life0 self, < br > session_key: & 'life1 < a class = "struct" href = "struct.SessionKey.html" title = "struct actix_session::storage::SessionKey" > SessionKey< / a > < br > ) -> < a class = "struct" href = "https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title = "struct core::pin::Pin" > Pin< / a > < < a class = "struct" href = "https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title = "struct alloc::boxed::Box" > Box< / a > < dyn < a class = "trait" href = "https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title = "trait core::future::future::Future" > Future< / a > < Output = < a class = "enum" href = "https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title = "enum core::result::Result" > Result< / a > < < a class = "enum" href = "https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title = "enum core::option::Option" > Option< / a > < < a class = "struct" href = "https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html" title = "struct std::collections::hash::map::HashMap" > HashMap< / a > < < a class = "struct" href = "https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title = "struct alloc::string::String" > String< / a > , < a class = "struct" href = "https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title = "struct alloc::string::String" > String< / a > > > , < a class = "enum" href = "enum.LoadError.html" title = "enum actix_session::storage::LoadError" > LoadError< / a > > > + 'async_trait> > < br > < span class = "where" > where< br > 'life0: 'async_trait,< br > 'life1: 'async_trait,< br > Self: 'async_trait< / span > ;
2022-05-18 11:58:19 +02:00
< span class = "item-spacer" > < / span > fn < a href = "#tymethod.save" class = "fnname" > save< / a > < 'life0, 'life1, 'async_trait> (< br > & 'life0 self, < br > session_state: < a class = "struct" href = "https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html" title = "struct std::collections::hash::map::HashMap" > HashMap< / a > < < a class = "struct" href = "https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title = "struct alloc::string::String" > String< / a > , < a class = "struct" href = "https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title = "struct alloc::string::String" > String< / a > > , < br > ttl: & 'life1 Duration< br > ) -> < a class = "struct" href = "https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title = "struct core::pin::Pin" > Pin< / a > < < a class = "struct" href = "https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title = "struct alloc::boxed::Box" > Box< / a > < dyn < a class = "trait" href = "https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title = "trait core::future::future::Future" > Future< / a > < Output = < a class = "enum" href = "https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title = "enum core::result::Result" > Result< / a > < < a class = "struct" href = "struct.SessionKey.html" title = "struct actix_session::storage::SessionKey" > SessionKey< / a > , < a class = "enum" href = "enum.SaveError.html" title = "enum actix_session::storage::SaveError" > SaveError< / a > > > + 'async_trait> > < br > < span class = "where" > where< br > 'life0: 'async_trait,< br > 'life1: 'async_trait,< br > Self: 'async_trait< / span > ;
< span class = "item-spacer" > < / span > fn < a href = "#tymethod.update" class = "fnname" > update< / a > < 'life0, 'life1, 'async_trait> (< br > & 'life0 self, < br > session_key: < a class = "struct" href = "struct.SessionKey.html" title = "struct actix_session::storage::SessionKey" > SessionKey< / a > , < br > session_state: < a class = "struct" href = "https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html" title = "struct std::collections::hash::map::HashMap" > HashMap< / a > < < a class = "struct" href = "https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title = "struct alloc::string::String" > String< / a > , < a class = "struct" href = "https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title = "struct alloc::string::String" > String< / a > > , < br > ttl: & 'life1 Duration< br > ) -> < a class = "struct" href = "https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title = "struct core::pin::Pin" > Pin< / a > < < a class = "struct" href = "https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title = "struct alloc::boxed::Box" > Box< / a > < dyn < a class = "trait" href = "https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title = "trait core::future::future::Future" > Future< / a > < Output = < a class = "enum" href = "https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title = "enum core::result::Result" > Result< / a > < < a class = "struct" href = "struct.SessionKey.html" title = "struct actix_session::storage::SessionKey" > SessionKey< / a > , < a class = "enum" href = "enum.UpdateError.html" title = "enum actix_session::storage::UpdateError" > UpdateError< / a > > > + 'async_trait> > < br > < span class = "where" > where< br > 'life0: 'async_trait,< br > 'life1: 'async_trait,< br > Self: 'async_trait< / span > ;
< span class = "item-spacer" > < / span > fn < a href = "#tymethod.delete" class = "fnname" > delete< / a > < 'life0, 'life1, 'async_trait> (< br > & 'life0 self, < br > session_key: & 'life1 < a class = "struct" href = "struct.SessionKey.html" title = "struct actix_session::storage::SessionKey" > SessionKey< / a > < br > ) -> < a class = "struct" href = "https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title = "struct core::pin::Pin" > Pin< / a > < < a class = "struct" href = "https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title = "struct alloc::boxed::Box" > Box< / a > < dyn < a class = "trait" href = "https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title = "trait core::future::future::Future" > Future< / a > < Output = < a class = "enum" href = "https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title = "enum core::result::Result" > Result< / a > < < a class = "primitive" href = "https://doc.rust-lang.org/nightly/std/primitive.unit.html" > ()< / a > , < a class = "struct" href = "https://docs.rs/anyhow/1.0.57/anyhow/struct.Error.html" title = "struct anyhow::Error" > Error< / a > > > + 'async_trait> > < br > < span class = "where" > where< br > 'life0: 'async_trait,< br > 'life1: 'async_trait,< br > Self: 'async_trait< / span > ;
2022-03-06 00:25:11 +01:00
}< / code > < / pre > < / div > < details class = "rustdoc-toggle top-doc" open > < summary class = "hideme" > < span > Expand description< / span > < / summary > < div class = "docblock" > < p > The interface to retrieve and save the current session data from/to the chosen storage backend.< / p >
< p > You can provide your own custom session store backend by implementing this trait.< / p >
2022-03-15 17:29:58 +01:00
< p > < a href = "https://docs.rs/async-trait" > < code > async-trait< / code > < / a > is used for this trait’ s definition. Therefore, it
is required for implementations, too. In particular, we use the send-optional variant:
< code > #[async_trait(?Send)]< / code > .< / p >
2022-05-18 11:58:19 +02:00
< / div > < / details > < h2 id = "required-methods" class = "small-section-header" > Required Methods< a href = "#required-methods" class = "anchor" > < / a > < / h2 > < div class = "methods" > < details class = "rustdoc-toggle" open > < summary > < div id = "tymethod.load" class = "method has-srclink" > < div class = "rightside" > < a class = "srclink" href = "../../src/actix_session/storage/interface.rs.html#20" > source< / a > < / div > < h4 class = "code-header" > fn < a href = "#tymethod.load" class = "fnname" > load< / a > < 'life0, 'life1, 'async_trait> (< br > & 'life0 self, < br > session_key: & 'life1 < a class = "struct" href = "struct.SessionKey.html" title = "struct actix_session::storage::SessionKey" > SessionKey< / a > < br > ) -> < a class = "struct" href = "https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title = "struct core::pin::Pin" > Pin< / a > < < a class = "struct" href = "https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title = "struct alloc::boxed::Box" > Box< / a > < dyn < a class = "trait" href = "https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title = "trait core::future::future::Future" > Future< / a > < Output = < a class = "enum" href = "https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title = "enum core::result::Result" > Result< / a > < < a class = "enum" href = "https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title = "enum core::option::Option" > Option< / a > < < a class = "struct" href = "https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html" title = "struct std::collections::hash::map::HashMap" > HashMap< / a > < < a class = "struct" href = "https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title = "struct alloc::string::String" > String< / a > , < a class = "struct" href = "https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title = "struct alloc::string::String" > String< / a > > > , < a class = "enum" href = "enum.LoadError.html" title = "enum actix_session::storage::LoadError" > LoadError< / a > > > + 'async_trait> > < span class = "where fmt-newline" > where< br > 'life0: 'async_trait,< br > 'life1: 'async_trait,< br > Self: 'async_trait, < / span > < / h4 > < / div > < / summary > < div class = "docblock" > < p > Loads the session state associated to a session key.< / p >
2022-03-15 17:29:58 +01:00
< / div > < / details > < details class = "rustdoc-toggle" open > < summary > < div id = "tymethod.save" class = "method has-srclink" > < div class = "rightside" > < a class = "srclink" href = "../../src/actix_session/storage/interface.rs.html#25-29" > source< / a > < / div > < h4 class = "code-header" > fn < a href = "#tymethod.save" class = "fnname" > save< / a > < 'life0, 'life1, 'async_trait> (< br > & 'life0 self, < br > session_state: < a class = "struct" href = "https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html" title = "struct std::collections::hash::map::HashMap" > HashMap< / a > < < a class = "struct" href = "https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title = "struct alloc::string::String" > String< / a > , < a class = "struct" href = "https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title = "struct alloc::string::String" > String< / a > > , < br > ttl: & 'life1 Duration< br > ) -> < a class = "struct" href = "https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title = "struct core::pin::Pin" > Pin< / a > < < a class = "struct" href = "https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title = "struct alloc::boxed::Box" > Box< / a > < dyn < a class = "trait" href = "https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title = "trait core::future::future::Future" > Future< / a > < Output = < a class = "enum" href = "https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title = "enum core::result::Result" > Result< / a > < < a class = "struct" href = "struct.SessionKey.html" title = "struct actix_session::storage::SessionKey" > SessionKey< / a > , < a class = "enum" href = "enum.SaveError.html" title = "enum actix_session::storage::SaveError" > SaveError< / a > > > + 'async_trait> > < span class = "where fmt-newline" > where< br > 'life0: 'async_trait,< br > 'life1: 'async_trait,< br > Self: 'async_trait, < / span > < / h4 > < / div > < / summary > < div class = "docblock" > < p > Persist the session state for a newly created session.< / p >
2022-03-06 00:25:11 +01:00
< p > Returns the corresponding session key.< / p >
2022-03-15 17:29:58 +01:00
< / div > < / details > < details class = "rustdoc-toggle" open > < summary > < div id = "tymethod.update" class = "method has-srclink" > < div class = "rightside" > < a class = "srclink" href = "../../src/actix_session/storage/interface.rs.html#32-37" > source< / a > < / div > < h4 class = "code-header" > fn < a href = "#tymethod.update" class = "fnname" > update< / a > < 'life0, 'life1, 'async_trait> (< br > & 'life0 self, < br > session_key: < a class = "struct" href = "struct.SessionKey.html" title = "struct actix_session::storage::SessionKey" > SessionKey< / a > , < br > session_state: < a class = "struct" href = "https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html" title = "struct std::collections::hash::map::HashMap" > HashMap< / a > < < a class = "struct" href = "https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title = "struct alloc::string::String" > String< / a > , < a class = "struct" href = "https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title = "struct alloc::string::String" > String< / a > > , < br > ttl: & 'life1 Duration< br > ) -> < a class = "struct" href = "https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title = "struct core::pin::Pin" > Pin< / a > < < a class = "struct" href = "https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title = "struct alloc::boxed::Box" > Box< / a > < dyn < a class = "trait" href = "https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title = "trait core::future::future::Future" > Future< / a > < Output = < a class = "enum" href = "https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title = "enum core::result::Result" > Result< / a > < < a class = "struct" href = "struct.SessionKey.html" title = "struct actix_session::storage::SessionKey" > SessionKey< / a > , < a class = "enum" href = "enum.UpdateError.html" title = "enum actix_session::storage::UpdateError" > UpdateError< / a > > > + 'async_trait> > < span class = "where fmt-newline" > where< br > 'life0: 'async_trait,< br > 'life1: 'async_trait,< br > Self: 'async_trait, < / span > < / h4 > < / div > < / summary > < div class = "docblock" > < p > Updates the session state associated to a pre-existing session key.< / p >
2022-05-18 11:58:19 +02:00
< / div > < / details > < details class = "rustdoc-toggle" open > < summary > < div id = "tymethod.delete" class = "method has-srclink" > < div class = "rightside" > < a class = "srclink" href = "../../src/actix_session/storage/interface.rs.html#40" > source< / a > < / div > < h4 class = "code-header" > fn < a href = "#tymethod.delete" class = "fnname" > delete< / a > < 'life0, 'life1, 'async_trait> (< br > & 'life0 self, < br > session_key: & 'life1 < a class = "struct" href = "struct.SessionKey.html" title = "struct actix_session::storage::SessionKey" > SessionKey< / a > < br > ) -> < a class = "struct" href = "https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title = "struct core::pin::Pin" > Pin< / a > < < a class = "struct" href = "https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title = "struct alloc::boxed::Box" > Box< / a > < dyn < a class = "trait" href = "https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title = "trait core::future::future::Future" > Future< / a > < Output = < a class = "enum" href = "https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title = "enum core::result::Result" > Result< / a > < < a class = "primitive" href = "https://doc.rust-lang.org/nightly/std/primitive.unit.html" > ()< / a > , < a class = "struct" href = "https://docs.rs/anyhow/1.0.57/anyhow/struct.Error.html" title = "struct anyhow::Error" > Error< / a > > > + 'async_trait> > < span class = "where fmt-newline" > where< br > 'life0: 'async_trait,< br > 'life1: 'async_trait,< br > Self: 'async_trait, < / span > < / h4 > < / div > < / summary > < div class = "docblock" > < p > Deletes a session from the store.< / p >
2022-06-16 21:46:24 +02:00
< / div > < / details > < / div > < h2 id = "implementors" class = "small-section-header" > Implementors< a href = "#implementors" class = "anchor" > < / a > < / h2 > < div class = "item-list" id = "implementors-list" > < section id = "impl-SessionStore" class = "impl has-srclink" > < span class = "rightside" > < a class = "srclink" href = "../../src/actix_session/storage/cookie.rs.html#55-95" > source< / a > < / span > < a href = "#impl-SessionStore" class = "anchor" > < / a > < h3 class = "code-header in-band" > impl < a class = "trait" href = "trait.SessionStore.html" title = "trait actix_session::storage::SessionStore" > SessionStore< / a > for < a class = "struct" href = "struct.CookieSessionStore.html" title = "struct actix_session::storage::CookieSessionStore" > CookieSessionStore< / a > < / h3 > < / section > < section id = "impl-SessionStore-1" class = "impl has-srclink" > < span class = "rightside" > < a class = "srclink" href = "../../src/actix_session/storage/redis_actor.rs.html#123-258" > source< / a > < / span > < a href = "#impl-SessionStore-1" class = "anchor" > < / a > < h3 class = "code-header in-band" > impl < a class = "trait" href = "trait.SessionStore.html" title = "trait actix_session::storage::SessionStore" > SessionStore< / a > for < a class = "struct" href = "struct.RedisActorSessionStore.html" title = "struct actix_session::storage::RedisActorSessionStore" > RedisActorSessionStore< / a > < / h3 > < / section > < section id = "impl-SessionStore-2" class = "impl has-srclink" > < span class = "rightside" > < a class = "srclink" href = "../../src/actix_session/storage/redis_rs.rs.html#136-233" > source< / a > < / span > < a href = "#impl-SessionStore-2" class = "anchor" > < / a > < h3 class = "code-header in-band" > impl < a class = "trait" href = "trait.SessionStore.html" title = "trait actix_session::storage::SessionStore" > SessionStore< / a > for < a class = "struct" href = "struct.RedisSessionStore.html" title = "struct actix_session::storage::RedisSessionStore" > RedisSessionStore< / a > < / h3 > < / section > < / div > < script type = "text/javascript" src = "../../implementors/actix_session/storage/interface/trait.SessionStore.js" data-ignore-extern-crates = "" async > < / script > < / section > < / div > < / main > < div id = "rustdoc-vars" data-root-path = "../../" data-current-crate = "actix_session" data-themes = "ayu,dark,light" data-resource-suffix = "" data-rustdoc-version = "1.63.0-nightly (b31f9cc22 2022-06-15)" > < / div >
2022-03-06 00:25:11 +01:00
< / body > < / html >