37 lines
19 KiB
HTML
37 lines
19 KiB
HTML
<!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="API documentation for the Rust `Transform` trait in crate `actix_service`."><meta name="keywords" content="rust, rustlang, rust-lang, Transform"><title>actix_service::Transform - Rust</title><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="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc trait"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../actix_service/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><p class='location'>Trait Transform</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#associated-types">Associated Types</a><div class="sidebar-links"><a href="#associatedtype.Request">Request</a><a href="#associatedtype.Response">Response</a><a href="#associatedtype.Error">Error</a><a href="#associatedtype.Transform">Transform</a><a href="#associatedtype.InitError">InitError</a><a href="#associatedtype.Future">Future</a></div><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.new_transform">new_transform</a></div><a class="sidebar-title" href="#provided-methods">Provided Methods</a><div class="sidebar-links"><a href="#method.from_err">from_err</a><a href="#method.map_init_err">map_init_err</a></div><a class="sidebar-title" href="#foreign-impls">Implementations on Foreign Types</a><div class="sidebar-links"><a href="#impl-Transform%3CS%3E-for-Arc%3CT%3E">Arc<T></a><a href="#impl-Transform%3CS%3E-for-Rc%3CT%3E">Rc<T></a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class='location'><a href='index.html'>actix_service</a></p><script>window.sidebarCurrent = {name: 'Transform', ty: 'trait', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>−</span>]</a></span><a class='srclink' href='../src/actix_service/transform.rs.html#14-75' title='goto source code'>[src]</a></span><span class='in-band'>Trait <a href='index.html'>actix_service</a>::<wbr><a class="trait" href=''>Transform</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust trait'>pub trait Transform<S> {
|
||
type <a href='#associatedtype.Request' class="type">Request</a>;
|
||
type <a href='#associatedtype.Response' class="type">Response</a>;
|
||
type <a href='#associatedtype.Error' class="type">Error</a>;
|
||
type <a href='#associatedtype.Transform' class="type">Transform</a>: <a class="trait" href="../actix_service/trait.Service.html" title="trait actix_service::Service">Service</a><Request = Self::<a class="type" href="../actix_service/trait.Transform.html#associatedtype.Request" title="type actix_service::Transform::Request">Request</a>, Response = Self::<a class="type" href="../actix_service/trait.Transform.html#associatedtype.Response" title="type actix_service::Transform::Response">Response</a>, Error = Self::<a class="type" href="../actix_service/trait.Transform.html#associatedtype.Error" title="type actix_service::Transform::Error">Error</a>>;
|
||
type <a href='#associatedtype.InitError' class="type">InitError</a>;
|
||
type <a href='#associatedtype.Future' class="type">Future</a>: <a class="trait" href="../futures/future/trait.Future.html" title="trait futures::future::Future">Future</a><Item = Self::<a class="type" href="../actix_service/trait.Transform.html#associatedtype.Transform" title="type actix_service::Transform::Transform">Transform</a>, Error = Self::<a class="type" href="../actix_service/trait.Transform.html#associatedtype.InitError" title="type actix_service::Transform::InitError">InitError</a>>;
|
||
fn <a href='#tymethod.new_transform' class='fnname'>new_transform</a>(&self, service: S) -> Self::<a class="type" href="../actix_service/trait.Transform.html#associatedtype.Future" title="type actix_service::Transform::Future">Future</a>;
|
||
|
||
fn <a href='#method.map_init_err' class='fnname'>map_init_err</a><F, E>(self, f: F) -> TransformMapInitErr<Self, S, F, E><br> <span class="where">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,<br> F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>(Self::<a class="type" href="../actix_service/trait.Transform.html#associatedtype.InitError" title="type actix_service::Transform::InitError">InitError</a>) -> E</span>,
|
||
{ ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.from_err' class='fnname'>from_err</a><E>(self) -> TransformFromErr<Self, S, E><br> <span class="where">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,<br> E: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><Self::<a class="type" href="../actix_service/trait.Transform.html#associatedtype.InitError" title="type actix_service::Transform::InitError">InitError</a>></span>,
|
||
{ ... }
|
||
}</pre></div><div class='docblock'><p>The <code>Transform</code> trait defines the interface of a Service factory. <code>Transform</code>
|
||
is often implemented for middleware, defining how to construct a
|
||
middleware Service. A Service that is constructed by the factory takes
|
||
the Service that follows it during execution as a parameter, assuming
|
||
ownership of the next Service.</p>
|
||
</div>
|
||
<h2 id='associated-types' class='small-section-header'>Associated Types<a href='#associated-types' class='anchor'></a></h2><div class='methods'><h3 id='associatedtype.Request' class='method'><code id='Request.t'>type <a href='#associatedtype.Request' class="type">Request</a></code></h3><div class='docblock'><p>Requests handled by the service.</p>
|
||
</div><h3 id='associatedtype.Response' class='method'><code id='Response.t'>type <a href='#associatedtype.Response' class="type">Response</a></code></h3><div class='docblock'><p>Responses given by the service.</p>
|
||
</div><h3 id='associatedtype.Error' class='method'><code id='Error.t'>type <a href='#associatedtype.Error' class="type">Error</a></code></h3><div class='docblock'><p>Errors produced by the service.</p>
|
||
</div><h3 id='associatedtype.Transform' class='method'><code id='Transform.t'>type <a href='#associatedtype.Transform' class="type">Transform</a>: <a class="trait" href="../actix_service/trait.Service.html" title="trait actix_service::Service">Service</a><Request = Self::<a class="type" href="../actix_service/trait.Transform.html#associatedtype.Request" title="type actix_service::Transform::Request">Request</a>, Response = Self::<a class="type" href="../actix_service/trait.Transform.html#associatedtype.Response" title="type actix_service::Transform::Response">Response</a>, Error = Self::<a class="type" href="../actix_service/trait.Transform.html#associatedtype.Error" title="type actix_service::Transform::Error">Error</a>></code></h3><div class='docblock'><p>The <code>TransformService</code> value created by this factory</p>
|
||
</div><h3 id='associatedtype.InitError' class='method'><code id='InitError.t'>type <a href='#associatedtype.InitError' class="type">InitError</a></code></h3><div class='docblock'><p>Errors produced while building a service.</p>
|
||
</div><h3 id='associatedtype.Future' class='method'><code id='Future.t'>type <a href='#associatedtype.Future' class="type">Future</a>: <a class="trait" href="../futures/future/trait.Future.html" title="trait futures::future::Future">Future</a><Item = Self::<a class="type" href="../actix_service/trait.Transform.html#associatedtype.Transform" title="type actix_service::Transform::Transform">Transform</a>, Error = Self::<a class="type" href="../actix_service/trait.Transform.html#associatedtype.InitError" title="type actix_service::Transform::InitError">InitError</a>></code></h3><div class='docblock'><p>The future response value.</p>
|
||
</div></div><span class='loading-content'>Loading content...</span>
|
||
<h2 id='required-methods' class='small-section-header'>Required methods<a href='#required-methods' class='anchor'></a></h2><div class='methods'><h3 id='tymethod.new_transform' class='method'><code id='new_transform.v'>fn <a href='#tymethod.new_transform' class='fnname'>new_transform</a>(&self, service: S) -> Self::<a class="type" href="../actix_service/trait.Transform.html#associatedtype.Future" title="type actix_service::Transform::Future">Future</a></code></h3><div class='docblock'><p>Creates and returns a new Service component, asynchronously</p>
|
||
</div></div><span class='loading-content'>Loading content...</span>
|
||
<h2 id='provided-methods' class='small-section-header'>Provided methods<a href='#provided-methods' class='anchor'></a></h2><div class='methods'><h3 id='method.map_init_err' class='method'><code id='map_init_err.v'>fn <a href='#method.map_init_err' class='fnname'>map_init_err</a><F, E>(self, f: F) -> TransformMapInitErr<Self, S, F, E> <span class="where fmt-newline">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,<br> F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>(Self::<a class="type" href="../actix_service/trait.Transform.html#associatedtype.InitError" title="type actix_service::Transform::InitError">InitError</a>) -> E, </span></code></h3><div class='docblock'><p>Map this service's factory error to a different error,
|
||
returning a new transform service factory.</p>
|
||
</div><h3 id='method.from_err' class='method'><code id='from_err.v'>fn <a href='#method.from_err' class='fnname'>from_err</a><E>(self) -> TransformFromErr<Self, S, E> <span class="where fmt-newline">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,<br> E: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><Self::<a class="type" href="../actix_service/trait.Transform.html#associatedtype.InitError" title="type actix_service::Transform::InitError">InitError</a>>, </span></code></h3><div class='docblock'><p>Map this service's init error to any error implementing <code>From</code> for
|
||
this service<code>s </code>Error`.</p>
|
||
<p>Note that this function consumes the receiving transform and returns a
|
||
wrapped version of it.</p>
|
||
</div></div><span class='loading-content'>Loading content...</span>
|
||
<h2 id='foreign-impls' class='small-section-header'>Implementations on Foreign Types<a href='#foreign-impls' class='anchor'></a></h2><h3 id='impl-Transform%3CS%3E-for-Rc%3CT%3E' class='impl'><code class='in-band'>impl<T, S> <a class="trait" href="../actix_service/trait.Transform.html" title="trait actix_service::Transform">Transform</a><S> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/rc/struct.Rc.html" title="struct alloc::rc::Rc">Rc</a><T> <span class="where fmt-newline">where<br> T: <a class="trait" href="../actix_service/trait.Transform.html" title="trait actix_service::Transform">Transform</a><S>, </span></code><a href='#impl-Transform%3CS%3E-for-Rc%3CT%3E' class='anchor'></a><a class='srclink' href='../src/actix_service/transform.rs.html#77-91' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Request-1' class="type"><code id='Request.t-1'>type <a href='#associatedtype.Request' class="type">Request</a> = T::<a class="type" href="../actix_service/trait.Transform.html#associatedtype.Request" title="type actix_service::Transform::Request">Request</a></code></h4><h4 id='associatedtype.Response-1' class="type"><code id='Response.t-1'>type <a href='#associatedtype.Response' class="type">Response</a> = T::<a class="type" href="../actix_service/trait.Transform.html#associatedtype.Response" title="type actix_service::Transform::Response">Response</a></code></h4><h4 id='associatedtype.Error-1' class="type"><code id='Error.t-1'>type <a href='#associatedtype.Error' class="type">Error</a> = T::<a class="type" href="../actix_service/trait.Transform.html#associatedtype.Error" title="type actix_service::Transform::Error">Error</a></code></h4><h4 id='associatedtype.InitError-1' class="type"><code id='InitError.t-1'>type <a href='#associatedtype.InitError' class="type">InitError</a> = T::<a class="type" href="../actix_service/trait.Transform.html#associatedtype.InitError" title="type actix_service::Transform::InitError">InitError</a></code></h4><h4 id='associatedtype.Transform-1' class="type"><code id='Transform.t-1'>type <a href='#associatedtype.Transform' class="type">Transform</a> = T::<a class="type" href="../actix_service/trait.Transform.html#associatedtype.Transform" title="type actix_service::Transform::Transform">Transform</a></code></h4><h4 id='associatedtype.Future-1' class="type"><code id='Future.t-1'>type <a href='#associatedtype.Future' class="type">Future</a> = T::<a class="type" href="../actix_service/trait.Transform.html#associatedtype.Future" title="type actix_service::Transform::Future">Future</a></code></h4><h4 id='method.new_transform' class="method hidden"><code id='new_transform.v-1'>fn <a href='#method.new_transform' class='fnname'>new_transform</a>(&self, service: S) -> T::<a class="type" href="../actix_service/trait.Transform.html#associatedtype.Future" title="type actix_service::Transform::Future">Future</a></code><a class='srclink' href='../src/actix_service/transform.rs.html#88-90' title='goto source code'>[src]</a></h4></div><h3 id='impl-Transform%3CS%3E-for-Arc%3CT%3E' class='impl'><code class='in-band'>impl<T, S> <a class="trait" href="../actix_service/trait.Transform.html" title="trait actix_service::Transform">Transform</a><S> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a><T> <span class="where fmt-newline">where<br> T: <a class="trait" href="../actix_service/trait.Transform.html" title="trait actix_service::Transform">Transform</a><S>, </span></code><a href='#impl-Transform%3CS%3E-for-Arc%3CT%3E' class='anchor'></a><a class='srclink' href='../src/actix_service/transform.rs.html#93-107' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Request-2' class="type"><code id='Request.t-2'>type <a href='#associatedtype.Request' class="type">Request</a> = T::<a class="type" href="../actix_service/trait.Transform.html#associatedtype.Request" title="type actix_service::Transform::Request">Request</a></code></h4><h4 id='associatedtype.Response-2' class="type"><code id='Response.t-2'>type <a href='#associatedtype.Response' class="type">Response</a> = T::<a class="type" href="../actix_service/trait.Transform.html#associatedtype.Response" title="type actix_service::Transform::Response">Response</a></code></h4><h4 id='associatedtype.Error-2' class="type"><code id='Error.t-2'>type <a href='#associatedtype.Error' class="type">Error</a> = T::<a class="type" href="../actix_service/trait.Transform.html#associatedtype.Error" title="type actix_service::Transform::Error">Error</a></code></h4><h4 id='associatedtype.InitError-2' class="type"><code id='InitError.t-2'>type <a href='#associatedtype.InitError' class="type">InitError</a> = T::<a class="type" href="../actix_service/trait.Transform.html#associatedtype.InitError" title="type actix_service::Transform::InitError">InitError</a></code></h4><h4 id='associatedtype.Transform-2' class="type"><code id='Transform.t-2'>type <a href='#associatedtype.Transform' class="type">Transform</a> = T::<a class="type" href="../actix_service/trait.Transform.html#associatedtype.Transform" title="type actix_service::Transform::Transform">Transform</a></code></h4><h4 id='associatedtype.Future-2' class="type"><code id='Future.t-2'>type <a href='#associatedtype.Future' class="type">Future</a> = T::<a class="type" href="../actix_service/trait.Transform.html#associatedtype.Future" title="type actix_service::Transform::Future">Future</a></code></h4><h4 id='method.new_transform-1' class="method hidden"><code id='new_transform.v-2'>fn <a href='#method.new_transform' class='fnname'>new_transform</a>(&self, service: S) -> T::<a class="type" href="../actix_service/trait.Transform.html#associatedtype.Future" title="type actix_service::Transform::Future">Future</a></code><a class='srclink' href='../src/actix_service/transform.rs.html#104-106' title='goto source code'>[src]</a></h4></div><span class='loading-content'>Loading content...</span>
|
||
<h2 id='implementors' class='small-section-header'>Implementors<a href='#implementors' class='anchor'></a></h2><div class='item-list' id='implementors-list'></div><span class='loading-content'>Loading content...</span><script type="text/javascript" src="../implementors/actix_service/trait.Transform.js" async></script></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "actix_service";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html> |