<!DOCTYPE html><htmllang="en"><head><metacharset="utf-8"><metaname="viewport"content="width=device-width, initial-scale=1.0"><metaname="generator"content="rustdoc"><metaname="description"content="Helper trait to retrieve an [`Identity`] instance from various `actix-web`’s types."><metaname="keywords"content="rust, rustlang, rust-lang, IdentityExt"><title>IdentityExt in actix_identity - Rust</title><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../SourceSerif4-Regular.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../FiraSans-Regular.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../FiraSans-Medium.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../SourceCodePro-Regular.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../SourceSerif4-Bold.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../SourceCodePro-Semibold.ttf.woff2"><linkrel="stylesheet"type="text/css"href="../normalize.css"><linkrel="stylesheet"type="text/css"href="../rustdoc.css"id="mainThemeStyle"><linkrel="stylesheet"type="text/css"href="../ayu.css"disabled><linkrel="stylesheet"type="text/css"href="../dark.css"disabled><linkrel="stylesheet"type="text/css"href="../light.css"id="themeStyle"><scriptid="default-settings"></script><scriptsrc="../storage.js"></script><scriptdefersrc="sidebar-items.js"></script><scriptdefersrc="../main.js"></script><noscript><linkrel="stylesheet"href="../noscript.css"></noscript><linkrel="alternate icon"type="image/png"href="../favicon-16x16.png"><linkrel="alternate icon"type="image/png"href="../favicon-32x32.png"><linkrel="icon"type="image/svg+xml"href="../favicon.svg"></head><bodyclass="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><navclass="mobile-topbar"><buttonclass="sidebar-menu-toggle">☰</button><aclass="sidebar-logo"href="../actix_identity/index.html"><divclass="logo-container"><imgclass="rust-logo"src="../rust-logo.svg"alt="logo"></div>
</a><h2class="location"><ahref="#">IdentityExt</a></h2><divclass="sidebar-elems"><section><divclass="block"><h3class="sidebar-title"><ahref="#required-methods">Required Methods</a></h3><ul><li><ahref="#tymethod.get_identity">get_identity</a></li></ul></div><divclass="block"><h3class="sidebar-title"><ahref="#foreign-impls">Implementations on Foreign Types</a></h3><ul><li><ahref="#impl-IdentityExt-for-GuardContext%3C%27a%3E">GuardContext<'a></a></li><li><ahref="#impl-IdentityExt-for-HttpRequest">HttpRequest</a></li><li><ahref="#impl-IdentityExt-for-ServiceRequest">ServiceRequest</a></li></ul></div><divclass="block"><h3class="sidebar-title"><ahref="#implementors">Implementors</a></h3></div></section><h2class="location"><ahref="index.html">In actix_identity</a></h2></div></nav><main><divclass="width-limiter"><divclass="sub-container"><aclass="sub-logo-container"href="../actix_identity/index.html"><imgclass="rust-logo"src="../rust-logo.svg"alt="logo"></a><navclass="sub"><formclass="search-form"><divclass="search-container"><span></span><inputclass="search-input"name="search"autocomplete="off"spellcheck="false"placeholder="Click or press ‘S’ to search, ‘?’ for more options…"type="search"><divid="help-button"title="help"tabindex="-1"><buttontype="button">?</button></div><divid="settings-menu"tabindex="-1">
}</code></pre></div><detailsclass="rustdoc-toggle top-doc"open><summaryclass="hideme"><span>Expand description</span></summary><divclass="docblock"><p>Helper trait to retrieve an <ahref="struct.Identity.html"title="Identity"><code>Identity</code></a> instance from various <code>actix-web</code>’s types.</p>
</div></details><h2id="required-methods"class="small-section-header">Required Methods<ahref="#required-methods"class="anchor"></a></h2><divclass="methods"><detailsclass="rustdoc-toggle"open><summary><divid="tymethod.get_identity"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../src/actix_identity/identity_ext.rs.html#8">source</a></div><h4class="code-header">fn <ahref="#tymethod.get_identity"class="fnname">get_identity</a>(&self) -><aclass="enum"href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html"title="enum core::result::Result">Result</a><<aclass="struct"href="struct.Identity.html"title="struct actix_identity::Identity">Identity</a>, <aclass="struct"href="https://docs.rs/anyhow/1.0.58/anyhow/struct.Error.html"title="struct anyhow::Error">Error</a>></h4></div></summary><divclass="docblock"><p>Retrieve the identity attached to the current session, if available.</p>